[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH: NSPathUtilities etc

From: Sheldon Gill
Subject: PATCH: NSPathUtilities etc
Date: Mon, 19 Jan 2004 16:56:30 +0800
User-agent: KMail/1.5.93

GNUstep, paths and the GFHS

GNUstep is being used across many different platforms, some more different 
than others. Although the GFHS defines a standard, there are reasons for 
bending the rules for many platforms. I think that the big contribution of 
the GFHS is to define the things to find in certain places, like what should 
go in Library. Changes in the root point for some of these heirarchies 
shouldn't make any difference.

The goal I wanted to pursue is to make GNUstep more path agnostic in a sane 
way. I've managed to make some strides in that direction by the following:

For ms-windows systems, GNUstep will source HKLM\Software\GNU\GNUstep for 
string keys. Coming one day soon. (see Win32 below)

For unix systems, GNUstep now sources "/etc/GNUstep/GNUstep.conf" at startup 
after looking at the environment variables. This sets a number of things 
including GNUSTEP_SYSTEM_ROOT and friends. The name of users gnustep 
directories and the defaults directories is also specified here.

SO, you can now define the way GNUstep should look on your system. The easiest 
way to grok the changes is to look at samples.

* EXAMPLE GNUstep.conf, #1
--------<cut here>--------
# MacOS X style of layout
--------<cut here>--------

* EXAMPLE GNUstep.conf, #2
--------<cut here>--------
# System paths
GNUSTEP_SYSTEM_ROOT  = /usr/GNUstep/System
GNUSTEP_LOCAL_ROOT  = /usr/local/

# GNUstep preferences
USER_GNUSTEP_RC  = .gnusteprc

# platform paths
SYS_PREFS = /etc
SYS_APPS = /bin
SYS_LIBS = /lib
SYS_ADMIN = /sbin
PLATFORM_LOCAL_APPS = /usr/local/bin
PLATFORM_LOCAL_LIBS = /usr/local/lib/
PLATFORM_APPS = /usr/bin
PLATFORM_LIBS = /usr/lib
PLATFORM_ADMIN = /usr/sbin
--------<cut here>--------

In this example, all users on this machine have their stuff in ~/OpenStep, 
with the Defaults database in ~/OpenStep/Defaults. It also shows the 
PLATFORM_PATH support which has been added. Now 
NSSearchPathForDirectoriesInDomains() can add platform specific paths. Now 
you can find "ping", "traceroute" and "finger" just like "ProjectCenter.app". 
This is also cool because I can now search for sounds, icons and wallpapers 
installed by GNOME and KDE. This is even easier via GSFindNamedFile().

Note that no changes have yet been made to gnustep-make so the install scripts 
there won't recognise your configuration.

* more flexibility in file system layout and naming without breaking anything
* no more sourcing /usr/GNUstep/System/Makefiles/GNUstep.sh
* libgnustep-base no longer requires gnustep-make to be installed just to run 
(no dependancy!)
* platform support for locating resources outside GNUstep in a step-friendly 
* frameworks can go into any /Library/Frameworks
* su to different user without breaking things

* NSPathUtilities.m -> the new implementation is in a place which corresponds 
to the header. It's shorter than the previous implementation with IMHO a 
better feature set and more inline documentation.
* Win32_Utilities.m -> the first module of a set to provide facilities needed 
for the MS-Windows port.
* Win32_Utilities.h -> header for the above. Currently thinking of a "Win32 
Additions" set.

* NSPathUtilities.h -> additional functionality included, some functions 
* NSBundle.m        -> Fixed searching for Frameworks in Library directories
* NSUser.m          -> thoroughly gutted. Will one day get a class for user 
* NSUserDefaults.m  -> Simplified and integrated with the changes.
* GNUmakefile       -> because there's new files

NSString *GSSystemRootDirectory(void) => use 
NSArray *GSStandardPathPrefixes(void) => use 
NSString *NSOpenStepRootDirectory(void) -> left in but shouldn't be used. 
Makes no sense anymore.

GSFindNamedFile       -> Makes finding a file/directory in the heirarchy 
really easy.
NSSearchPathDirectory -> Added keys for additional places like Frameworks and 

Make gnustep-make aware and respectful of the new way.
Improve installation system.

Openapp, debugapp should probably become Foundation-based tools rather than 
shell scripts.

The work is still progressing and much testing to be done. There's enough here 
to see the approach being taken. I didn't want to hold up the changes. The 
code currently works as it's always done so current Win32 remains the same. 
It will change soon, though. Currently developing a set of Win32 Additions 
which will only contain routines required by gnustep-base for inclusion.
Probably will then have another Win32 Additions set for gnustep-gui which will 
contain routines required by that library but useful at the application 

Comments and contributions welcome.


Attachment: NSPathUtilities.h.patch
Description: Text Data

Attachment: NSBundle.patch
Description: Text Data

Attachment: GNUmakefile.patch
Description: Text Data

Attachment: NSUser.patch
Description: Text Data

Attachment: NSUserDefaults.patch
Description: Text Data

Attachment: Win32_Utilities.h
Description: Text Data

Attachment: NSPathUtilities.m
Description: Text Data

Attachment: Win32_Utilities.m
Description: Text Data

Attachment: NSPathUtilities.patch.changelog
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]