get_proper_path
Definition: | string path = get_proper_path(sequence filepath, object rootdir=0) |
Description: | Return the fully qualified absolute path and file name of the specified file. |
pwa/p2js: | Implemented in p2js.js as a null function, mainly so that builtins\file_utils.e can be auto-transpiled. |
Comments: |
The root directory is only used when filepath is relative rather than absolute. If no root directory is provided, and one is needed, current_dir() is used. Both forwardslash ('/') and backslash ('\\') are supported on all platforms, and converted appropriately in the output. Should work equally well for files and directories. The result has the correct file separators for the operating system and, on Windows, the exact case of any existing files and directories, the intention being that your application will not behave as if C:\Downloads\test.txt and C:\downloadS/TEST.TXT are two different files, and things like find() work, without needing to resort to a loop and lower(x)=lower(y) on each element. The result should not be taken as confirmation of the actual existence of a file or directory. |
Examples: |
?get_proper_path(`C:\Downloads\dEad\TesT.txt`) -- `C:\Downloads\dead\test.txt` (TesT on p2js) ?get_proper_path(`C:\downloadS\deAd\TEST.TXT`) -- `C:\Downloads\dead\test.txt` (TEST on p2js) ?get_proper_path(`C:\prOgram Files (x86)\Phix`) -- `C:\Program Files (x86)\Phix` ... ?get_proper_path(`C:\bYetHost\EDITA`) -- `C:\byethost\edita` ?get_proper_path(`C:\UseRs\`) -- `C:\Users\` ?get_proper_path("p.exw") -- `C:\Program Files (x86)\Phix\p.exw` (`p.exw` on p2js) ?get_proper_path("demo") -- `C:\Program Files (x86)\Phix\demo` ('demo' on p2js) ?get_proper_path(`demo\`) -- `C:\Program Files (x86)\Phix\demo\` ('demo\' on p2js) |
Implementation: | See builtins\pgetpath.e (an autoinclude) for details of the actual implementation. |
See Also: | current_dir |
