Browse Source

Check default configuration locations before prompting.

Neal Wilson 7 years ago
parent
commit
f7e4208c45
1 changed files with 15 additions and 0 deletions
  1. 15
    0
      src/typica.w

+ 15
- 0
src/typica.w View File

4377
 the configuration file and load that instead of prompting for the information
4377
 the configuration file and load that instead of prompting for the information
4378
 if possible.
4378
 if possible.
4379
 
4379
 
4380
+Starting with version 1.8, if there is not a -c argument, Typica will first
4381
+search a small number of locations relative to the executable.
4382
+
4380
 @<Load the application configuration@>=
4383
 @<Load the application configuration@>=
4381
 QStringList arguments = QCoreApplication::arguments();
4384
 QStringList arguments = QCoreApplication::arguments();
4382
 int position = arguments.indexOf("-c");
4385
 int position = arguments.indexOf("-c");
4387
     {
4390
     {
4388
         filename = arguments.at(position + 1);
4391
         filename = arguments.at(position + 1);
4389
     }
4392
     }
4393
+} else {
4394
+	QDir checkPath(QCoreApplication::applicationDirPath() + "/../config/");
4395
+	if(checkPath.exists("config.xml")) {
4396
+		filename = checkPath.filePath("config.xml");
4397
+	} else {
4398
+		checkPath = QDir(QCoreApplication::applicationDirPath() + "/config/");
4399
+		if(checkPath.exists("config.xml")) {
4400
+			filename  = checkPath.filePath("config.xml");
4401
+		}
4402
+	}
4390
 }
4403
 }
4391
 if(filename.isEmpty())
4404
 if(filename.isEmpty())
4392
 {
4405
 {
4411
     {
4424
     {
4412
         app.configuration()->setContent(&file, true);
4425
         app.configuration()->setContent(&file, true);
4413
     }
4426
     }
4427
+} else {
4428
+	return 1;
4414
 }
4429
 }
4415
 @<Substitute included fragments@>@;
4430
 @<Substitute included fragments@>@;
4416
 
4431
 

Loading…
Cancel
Save