[Jslib] Re: Filesystem on Windows

Jacob Emcken jacob@emcken.dk
Fri, 07 Mar 2003 00:04:21 +0100


Yeah platform independent way of adressing the file system would be 
great, together with a function that could return platform dependent 
paths when given the platform independent path, and the other way around.
"My computer" could be like root (/) in Linux/unix (and MacOSX if I'm 
not mistaken). Then we would not only get drive letters but also "My 
Network Places" and all that crap.

And perhapes a way to validate a path/filename so that your not trying 
to create/rename with a invalid name. (containing illegal characters).
If you prompt the user of your application for a new filename or the 
user can access a dir directly with a prompt

function validatePath(path) {
   //the platform is global accessible in mozilla (isn't it)?
   switch(platform) {
      case "win":
        return isValidWinPath(path);
      case "linux":
        return isValidLinuxPath(path);
      case "mac":
        return isValidMacPath(path);
}

The functions isValid*Path returns true/false.

I think you get the picture now :)


rpg@sift.info wrote:
> I hope you don't mind my interjecting
Not at all :)