File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,7 +73,12 @@ GSSetUserName(NSString *aName);
7373 * to be read earlier.<br />
7474 * If you want to prevent the user specific config file from being
7575 * read, you must set the GNUSTEP_USER_CONFIG_FILE value in the
76- * dictionary to be an empty string.
76+ * dictionary to be an empty string.<br />
77+ * Paths with a leading ./ or ../ in the config are interpreted
78+ * relative to the config file location: if you are supplying a
79+ * dictionary to be used instead of the config file (so there is
80+ * no path to the config file), you must either use absolute paths,
81+ * or expect them to be relative to the program being executed.
7782 */
7883GS_EXPORT NSMutableDictionary *
7984GNUstepConfig (NSDictionary *newConfig);
Original file line number Diff line number Diff line change @@ -959,10 +959,11 @@ static void ExtractValuesFromConfig(NSDictionary *config)
959959 {
960960 NS_DURING
961961 {
962+ NSString *path;
963+
962964 if (newConfig == nil )
963965 {
964966 NSString *file = nil ;
965- NSString *path;
966967 NSEnumerator *e;
967968 NSString *defs;
968969 BOOL fromEnvironment = YES ;
@@ -1022,9 +1023,7 @@ static void ExtractValuesFromConfig(NSDictionary *config)
10221023 if ([file hasPrefix: @" ./" ] == YES
10231024 || [file hasPrefix: @" ../" ] == YES )
10241025 {
1025- Class c = [NSProcessInfo class ];
1026-
1027- path = GSPrivateSymbolPath (c);
1026+ path = GSPrivateSymbolPath ([NSProcessInfo class ]);
10281027 // Remove library name from path
10291028 path = [path stringByDeletingLastPathComponent ];
10301029 if (GSDebugSet (debugKey))
@@ -1132,7 +1131,15 @@ static void ExtractValuesFromConfig(NSDictionary *config)
11321131 else
11331132 {
11341133 conf = [newConfig mutableCopy ];
1134+
1135+ /* As config came from the program rather than a file
1136+ * we use the path to the executable as config path.
1137+ */
1138+ path = GSPrivateExecutablePath ();
1139+ path = [path stringByDeletingLastPathComponent ];
1140+ ASSIGN (gnustepConfigPath, path);
11351141 }
1142+
11361143 /* System admins may force the user and defaults paths by
11371144 * setting GNUSTEP_USER_CONFIG_FILE to be an empty string.
11381145 * If they simply don't define it at all, we assign a default.
You can’t perform that action at this time.
0 commit comments