Commit 7e586074 authored by John van Groningen's avatar John van Groningen

use DirSeparator or DirSeparatorString from Platform

instead of dirseparator from StdSystem from Object IO
parent 21d50c41
implementation module StdPathname
import StdArray, StdBool, StdChar, StdClass, StdInt, StdString, StdList
from StdSystem import dirseparator
import Platform
:: Pathname :== String
......@@ -29,7 +28,7 @@ RemovePath path
| found = path % (inc position, last);
= path;
where
(found,position)= FindLastChar dirseparator path last;
(found,position)= FindLastChar DirSeparator path last;
last = dec (size path);
......@@ -55,30 +54,28 @@ RemoveSuffix` path
// suf = path % (position, last);
// suffix = suf == ".dcl" || suf == ".icl" || suf == ".abc" || suf == ".o" || suf == ".prj";
last = dec (size path);
RemoveFilename :: !Pathname -> Pathname;
RemoveFilename path
# (found,position) = FindLastChar DirSeparator path (dec (size path));
| found
= path % (0, dec position);
= path;
where
(found,position) = FindLastChar dirseparator path (dec (size path));
replace_prefix_path :: !Pathname !Pathname !Pathname -> Pathname;
replace_prefix_path old_prefix_path new_prefix_path path
| old_prefix_path==path
= new_prefix_path;
| equal_path_prefix old_prefix_path path
= new_prefix_path +++ {dirseparator} +++ path % (inc (size old_prefix_path), dec (size path));
= new_prefix_path +++ DirSeparatorString +++ path % (inc (size old_prefix_path), dec (size path));
= path;
IsFullPathname :: !Pathname -> Bool;
IsFullPathname name = LastChar dirseparator name (dec (size name)) >= 0;
IsFullPathname name = LastChar DirSeparator name (dec (size name)) >= 0;
MakeFullPathname :: !Pathname !String -> Pathname;
MakeFullPathname path name = path +++ toString dirseparator +++ name;
MakeFullPathname path name = path +++ DirSeparatorString +++ name;
/* Auxilary functions */
equal_suffix :: !String !String -> Bool;
......@@ -95,7 +92,7 @@ equal_path_prefix :: !String !String -> Bool;
equal_path_prefix prefix string
| lengths<=lengthpre
= False;
= string.[inc lengthpre]==dirseparator && string % (0,lengthpre)==prefix;
= string.[inc lengthpre]==DirSeparator && string % (0,lengthpre)==prefix;
where
lengths = dec (size string);
lengthpre = dec (size prefix);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment