Archive: About Paths


About Paths
I'm writing a small exe for path manipulation (something related with "Path Manipulation" script in the archive) and now I'm implementing a sort of redundancy wrapper, so i can prevent some paths to be duplicated in the environment variable.
If PATH was (some stuff);C:\WINDOWS\COMMAND;(some other stuff);C:\WINDOWS\COMMAND;(even more stuff); then after my calculations will be (some stuff);(some other stuff);C:\WINDOWS\COMMAND;(even more stuff);

I'm thinking about a method to apply this algorithm on paths abbreviated by the tilde (~) char, like "C:\PROGRA~1\NOVELL\ZENWORKS", with their corresponding full name, like "C:\PROGRAM FILES\NOVELL\ZENWORKS"

Does anybody have any suggestion?


I'm not sure that the use of full paths is a good idea, e.g. in dos long paths are not recognised and could cause problems with some dos and/or 16-bit windows programs.

Vytautas


I know about this, but I'm just sure the path I need to tranlate will just be used out of a 16-bit environment (i.e. I will use my script after an installation process when the machine is at GUI level)
No need for DOS/startup-compliant path...


Thanks a lot for the post, anyway.


Yes but if the installer is used on a different machine it might need the short path, also I know that most enviroment variables have a limited lenght, in Win9x family anyway, and the use of full paths might make the PATH variable too long and thus create problems.

However your idea for the removal of duplicated entries could be very useful.

Vytautas


Hmm... Maybe I will think about a flag to preserve some of the paths (just in case...)

You're right: as far as I remember, Window$9x is limited on the lenght of the line you use to set the path (max 255 chars) and is also limited on the environmental space of the command processor (can override with "/E:nnnnn" when setting the default command shell in CONFIG.SYS)
I will think about a wrapper that works about the 240th char based on ";" proxymity... (will be very hard, I think...)

About removing the duplicates, I'm using a double-stack method with search of every element of stack in the output chain: if not found, copy the element of the stack 1 to the output chain; if found, skip it.

I know, it's a bit crappy (as i said!!)