NEDIT_HOME
Brought to you by:
tringali
(I don't know why I always forget this this SF thing.)
This will introduce the environmental variable
$NEDIT_HOME. If set, the names of the three NEdit
config files will be renamed as follows:
$HOME/.nedit -> $NEDIT_HOME/nedit.rc
$HOME/.neditmacro -> $NEDIT_HOME/autoload.nm
$HOME/.neditdb -> $NEDIT_HOME/nedit.history
This is checked on Linux and Solaris, the VMS name
creation algorithm is also checked.
Logged In: YES
user_id=73597
One more thing: are you sure about the way the VMS path
names are generated? It looks suspicious to me, but I don't
know how VMS specifies path names.
Logged In: YES
user_id=119143
I have separate functions because I want to avoid
coupling. These are little more than glorified string
copys, and any one of them could change in the future. If
the naming system gets more elaborate, chances are that at
least the autoload file name will be build differently, so
extension is actually easier this way.
I basically weighted DRY against KISS, and KISS won for me.
What do you think?
Wrt the dynamic allocation: Is that a bad thing?
Logged In: YES
user_id=119143
Wrt VMS: That's the best I could get out of the
discussions in the list.
Logged In: YES
user_id=73597
Saying that it's easier to customize is a poor
excuse for having duplicate code, especially
since it's not 1 or two lines we're talking about,
but a relatively complex piece of code (precondition
checking, platform dependent, ...)
If necessary, it's always easy to copy and paste
shared functionality to customize it later on.
Dynamic allocation is totally unnecessary here,
so it should be avoided (it could only confuse
leak detection tools). Moreover, there's absolutely
no reason to use an X String iso. a char*, and the
implicit conversion between the two in your code is
to be avoided too.
Update 2002-05-09
Update 2002-05-12
Update 2002-06-02
Update 2002-06-05
Logged In: YES
user_id=119143
This thing now works like this:
- If NEDIT_HOME is set, the filenames are as above,
- else, if ~/.nedit is a file, the old names are used,
- else, ~/.nedit is used as a directory, filenames as above.
- Any directories wanted but not available are created (no
trees).
- Everything is nice and clean in one function (and three
helper functions).
- Two of the three helper functions might be useful
elsewhere: isDir(filename) and isRegFile(filename).
- VMS support is the best I could do without a box. I got
help from some Mark Geary, Jack Patteeuw and Micheal Smith,
but possibly mixed up a few things.
Update 2002-06-23
Logged In: YES
user_id=73597
Closed since it was committed.
Logged In: YES
user_id=119143
Yup, and thanks to Alexander and Eddy.