RE: Current Directory
- Posted by Al Getz <Xaxo at aol.com> Feb 13, 2003
- 506 views
Hello, Having to interface with a file is much easier then having to interface with a human directly, except when it comes to errors. Derek wrote: >So how can I find out, using basic Euphoria, what is the current >directory >for ANY drive in the system? I dont think you can do that because maintaining a current directory for each drive is not supported in Euphoria, unless Rob plans to do this in 2.4, but i doubt it. As is, the process starts a new current directory and it's only one, not several. If you use the system() command it starts a new process, so you're starting with no current dir names again. One attempt is to use the system() command using the dos "cd mydir" command. This would probably work, except as soon as the command returns the directory is long forgotten so when you go to access the drive with the next system() command the current directory is back to "C:\" I guess you could create a dos server app but is it really worth it, and will it be as platform independent as you're looking for? On the other hand, maintaining a list yourself really isnt that hard. Use a sequence acessed by the drive letter and that will return (or set) the current directory for each drive. Not much of a problem. You can then use this info to resolve all your paths that are of the relative type. How hard can that really be? No direct dependence on dos either. You'll have to parse each path into it's type first, then update the drive list as required. The only thing you havent told us is how the user's data tells you when they decide to switch current directories for a particular drive? Note that the form: d:directory\filename.txt cant be the first entry in the file because it contains a relative path, and since there hasnt yet been a current directory established for that drive (other then "d:\"), this path would be invalid or it would have to name a path using the current directory "d:\" . I think you can check for valid paths by using: object=dir(). So, to repeat the question: How does the user convey the new current directory for a particular drive? Good luck with it, Al PS In most of my apps i've almost eliminated the concept of 'current directory' altogether because how do you know what it really is: startup directory or working directory? This means im now labeling my special directories "StartupDirectory" and "WorkingDirectory" respectively which clears matters up completely. I never have to maintain a current directory for each drive because i always use the full path, except for those two above, in which case i'll still use the full path but i'll construct it from one of those two.