:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: : class Io.Path.Public public Gilda: Perform file system operations on file paths. import Io.Directory.Public, Stack(string) : :............................................................................... :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: : method ABSOLUTE.PATH pure: Convert a path to a full path name. change Path string : In - OS path name (tame, either slash). :Out - A path name beginning from the root. : Windows - backslash, lowercase; : Unix - forward slashes; literal case. : :............................................................................... : method FORM.PATH.SLASH pure: lowercase; no trailing slash. change Path string :In - Os path (Exact case, any slash). :Out - lower or exact case; no trailing slash unless a : disk (<drive>:/), root(/), or net root (//). entry Forward = 0 Bit :1 - Separate by forward slash. 0 - Use Path.Slash. : :............................................................................... : function IS.PATH.SAME: Determine if 2 relative os paths are the same. entry Left string, &Os path names. The order does not matter. Right string exit Same Bit : :............................................................................... : function IS.DIRECTORY: Determine if a tame OS path is a directory. entry Path string :O.S. relative path (no wildcards, Os slashes). exit Directory Bit :0 if nonexistant or a file; 1 if a directory. : :............................................................................... : function IS.SUBDIRECTORY: Determine if a relative os path is a subdirectory. entry Path string, &A path that may be a subdirectory of Super. Super string :A path that may be above the Path. :Paths may have either slash and an optional trailing slash. exit Subdirectory Bit :1 if Path is a subdirectory of Super. :Equal paths match as well, even if files. : :............................................................................... : method RELATIVE.PATH pure: Remove leading dots from a relative OS path. change Path string :In - path; out tame relative path. : :............................................................................... : method TRIM.UP.DIRECTORY: Remove dot components. change Path string : In - Directory to check (os path, any slashes). :Out - Directory sans dots (froward slashes). : :............................................................................... : function TAIL.COMPONENT: Get the last component in a path. entry Path string :Os path (could be any .../ <tail> [/]). exit Tail string :Tail component (No trailing slash). Null if none. : :............................................................................... :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: : method SET.PERMISSION: Set flagged permissions (others are left as is). entry Path string :File path (tame, os). exit Status byte :0 - Okay; 1 - Can't set; else unknown. entry Read = 0 Bit, &1 - Set; 0 - Leave unchanged. Write = 0 Bit, & Exec = 0 Bit : :............................................................................... : method CLEAR.PERMISSION: Clear flagged permissions (others are left as is). entry Path string :File path (tame, os). exit Status byte :0 - Okay; 1 - Can't set; else unknown. entry Read = 0 Bit, &1 - Clear; 0 - Leave unchanged. Write = 0 Bit, & Exec = 0 Bit : :............................................................................... : method RESET.PERMISSION: Reset file permissions changed by Set.Permission. entry Path string :Same path used on Set.Permission call. exit Status byte :0 if okay. bit??? : :............................................................................... : function PATH.DIRECTORY: Get the directory portion of a path. entry Path string :Os path (could be any .../ <tail> [/]). exit Directory string :Path with the last component removed; :Trailing slash; "./" if none. : :............................................................................... end