More path handling tweaks.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21860 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2005-10-23 11:27:32 +00:00
parent 6ebfe03cf3
commit 8ba0f9a906
6 changed files with 35 additions and 35 deletions

View file

@ -1,6 +1,10 @@
2005-10-23 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSString.m: remove test method for path handling setup,
add environment variable (at least for a while until we are even
more sure that there are no problems with do-the-right-thing mode).
* Source/NSUserDefaults.m: More tweaks to use windows registry.
also remove test user default for path handling setup.
* Source/win32/NSUserDefaultsWin32.m: Rewrite
* Source/NSPathUtilities.m: Tweaks for windows.
Updates to (optionally) use windows registry to store defaults
@ -10,6 +14,7 @@
some bugs, and to conform to coding standards, Probably still has
bugs to fix, but seems usable now.
2005-10-20 Adam Fedor <fedor@gnu.org>
* Source/NSBundle.m (+pathsForResourcesOfType:inDirectory:,

View file

@ -276,6 +276,21 @@ notice and this notice are preserved.
GNUstep defaults to NSISOLatin1StringEncoding.
</p>
</desc>
<term>GNUSTEP_PATH_HANDLING</term>
<desc>
<p>
May be set to <code>unix</code> to enforce unix style path
handling, or <code>windows</code> to enforce mswindows style
path handling, or anu other value (including unset) for the
default behavior where both styles of paths should be
managed in the best way possible.
</p>
<p>
The option to enforce either upre unix or pure windows style
path handling (and hence this environment variable) may be
removed in a later release.
</p>
</desc>
<term>GNUSTEP_HOST_CPU</term>
<desc>
<p>

View file

@ -29,10 +29,10 @@
<section>
<heading>Path handling</heading>
<p>The rules for path handling depend on the value in the
<code>GSPathHandling</code> user default and, to some extent,
on the platform on which the program mis running.<br />
The understood values of GSPathHandling are <em>unix</em>
and <em>windows</em>. If GSPathHandling is any other value
<code>GNUSTEP_PATH_HANDLING</code> environment variable and,
to some extent, on the platform on which the program is running.<br />
The understood values of GNUSTEP_PATH_HANDLING are <em>unix</em>
and <em>windows</em>. If GNUSTEP_PATH_HANDLING is any other value
(or has not been set), GNUstep interprets this as meaning
it should try to <em>do-the-right-thing</em><br />
In the default mode of operation the system is very tolerant

View file

@ -173,22 +173,6 @@ enum {
*/
@interface NSString :NSObject <NSCoding, NSCopying, NSMutableCopying>
#ifndef NO_GNUSTEP
/**
* Sets the path handling mode for the NSString path manipulation methods.<br />
* <em>unix</em> mode treats paths as Unix/POSIX paths in which a slash (/)
* is the only path separator, and a single leading slash indicates an
* absolute path.<br />
* <em>windows</em> mode treats paths as windows drive-relative or UNC paths
* in which either slash (/) or backslash (\) may be used as path separators
* and the 'root' of a path may be of the form 'C:/' or '//host/share/'.<br />
* The mode selected if you provide any other argument to this
* method is the default <em>gnustep</em> mode, in which the system tries
* to <em>do-the-right-thing</em> and support both windows and unix style
* paths at the same time.
*/
+ (void) setPathHandling: (NSString*)mode;
#endif
+ (id) string;
+ (id) stringWithCharacters: (const unichar*)chars
length: (unsigned int)length;

View file

@ -435,6 +435,17 @@ handle_printf_atsign (FILE *stream,
_DefaultStringEncoding = GetDefEncoding();
_ByteEncodingOk = GSIsByteEncoding(_DefaultStringEncoding);
if (getenv("GNUSTEP_PATH_HANDLING") != 0)
{
if (strcmp("unix", getenv("GNUSTEP_PATH_HANDLING")) == 0)
{
pathHandling = PH_UNIX;
}
else if (strcmp("windows", getenv("GNUSTEP_PATH_HANDLING")) == 0)
{
pathHandling = PH_WINDOWS;
}
}
NSStringClass = self;
[self setVersion: 1];

View file

@ -100,7 +100,6 @@ static void updateCache(NSUserDefaults *self)
if (self == sharedDefaults)
{
NSArray *debug;
NSString *string;
/**
* If there is an array NSUserDefault called GNU-Debug,
@ -131,20 +130,6 @@ static void updateCache(NSUserDefaults *self)
= [self boolForKey: @"GSLogThread"];
flags[NSWriteOldStylePropertyLists]
= [self boolForKey: @"NSWriteOldStylePropertyLists"];
string = [self stringForKey: @"GSPathHandling"];
if (string != nil)
{
/*
* NB. path handling defaults to the 'gnustep' tolerant mode
* so that files can be handled to read in the defaults database.
* only once the database has been read in will the defaults
* system update the mode. This avoids a horrible recursion
* if we were to try to initialise the path handling mode from
* the defaults system.
*/
[NSString setPathHandling: string];
}
}
}