108 string joinPaths(list<string> paths);
112 abstract
string joinPathsIntern(list<string> paths);
232 const TMP_MAX_ATTEMPTS = 10000;
251 public hashdecl TmpFileHash {
253 File file =
new File();
271 hash<TmpFileHash>
make_tmp_file(*
string prefix, *
string suffix, *
string path);
369 bool same_file_stat(*hash<StatInfo> stat1, *hash<StatInfo> stat2,
bool ignore_errors = True);
389 bool same_file(
string path1,
string path2,
bool follow_symlinks = True,
bool ignore_errors = True);
426 bool overwrite = False,
bool merge = False,
bool fail_immediately = True, *
int depth) {
428 if (
same_file(source, destination, follow_symlinks, True));
431 list<auto> errors = ();
435 src_dir.chdir(source);
436 *hash<StatInfo> src_stat = follow_symlinks ? hstat(source) : hlstat(source);
437 if (!exists src_stat);
441 if (is_dir(destination) && (src_stat.type !=
'DIRECTORY' || !overwrite) && !merge);
445 mkdir(destination, 0700);
448 if (!exists depth || depth > 0);
451 chmod(destination, src_stat.mode);
487 string copy_file(
string source,
string destination,
bool follow_symlinks = False,
488 bool overwrite = False) {
489 if (
same_file(source, destination, follow_symlinks, True));
493 *hash<StatInfo> src_stat = follow_symlinks ? hstat(source) : hlstat(source);
494 if (!exists src_stat);
498 if (is_dir(destination));
500 *hash<StatInfo> dst_stat = hstat(destination);
501 if (!overwrite && exists dst_stat);
504 foreach *hash<StatInfo> stat in (src_stat, dst_stat);
507 if (src_stat.type ==
'SYMBOLIC-LINK' && !follow_symlinks);
512 src_obj.open2(source, O_RDONLY);
513 dst_obj.open2(destination, O_CREAT | O_TRUNC | O_WRONLY, 0600);
516 chmod(destination, src_stat.mode);
544 string copy_tree(
string source,
string destination,
bool follow_symlinks = False,
545 bool overwrite = False,
bool fail_immediately = True) {
546 return copy_tree_internal(source, destination, follow_symlinks, overwrite, False, fail_immediately);
573 string copy_path(
string source,
string destination,
bool follow_symlinks = False,
574 bool overwrite = False,
bool fail_immediately = True, *
int depth) {
577 return copy_file(source, destination, follow_symlinks, overwrite);
602 string merge_tree(
string source,
string destination,
bool follow_symlinks = False,
603 bool overwrite = False,
bool fail_immediately = True, *
int depth) {
604 return copy_tree_internal(source, destination, follow_symlinks, overwrite, True, fail_immediately, depth);
622 string move_path(
string source,
string destination,
bool overwrite = False);
643 string merge_path(
string source,
string destination,
bool follow_symlinks = False,
bool overwrite = False,
644 bool fail_immediately = True, *
int depth) {
648 return copy_file(source, destination, follow_symlinks, overwrite);
generic path handler implementing functionality common for both platforms
Definition: FsUtil.qm.dox.h:102
list< string > delimiters
path delimiters - to be set by platform specific path handlers
Definition: FsUtil.qm.dox.h:106
path handler implementing POSIX specific functionality
Definition: FsUtil.qm.dox.h:148
string joinPathsIntern(list< string > paths)
Returns the path resulting from joining the given paths.
constructor()
creates the object and sets the delimiter
Class implementing a user friendly temporary directory creation.
Definition: FsUtil.qm.dox.h:279
string path
The path to the temporary directory created in the constructor.
Definition: FsUtil.qm.dox.h:283
constructor(*string prefix, *string suffix, *string path)
Creates a unique temporary directory and returns its absolute path.
Class implementing a user friendly temporary file creation; the file is removed in the destructor.
Definition: FsUtil.qm.dox.h:298
constructor(*string prefix, *string suffix, *string path)
Creates and opens a unique temporary file and returns its absolute path as well as its File object.
path handler implementing Windows specific functionality
Definition: FsUtil.qm.dox.h:117
constructor()
creates the object and sets the delimiter
string joinPathsIntern(list< string > paths)
Returns the path resulting from joining the given paths.
list< string > splitDrive(string path)
separates and returns the drive and the rest of the path
the FsUtil namespace contains all the objects in the FsUtil module
Definition: FsUtil.qm.dox.h:97
string copy_path(string source, string destination, bool follow_symlinks=False, bool overwrite=False, bool fail_immediately=True, *int depth)
Universal copy function.
Definition: FsUtil.qm.dox.h:573
bool same_file_stat(*hash< StatInfo > stat1, *hash< StatInfo > stat2, bool ignore_errors=True)
Checks whether two stat hashes point to the same file or not.
bool same_file(string path1, string path2, bool follow_symlinks=True, bool ignore_errors=True)
Checks whether two paths point to the same file/directory or not.
remove_path(string path)
Universal remove function.
string copy_file(string source, string destination, bool follow_symlinks=False, bool overwrite=False)
Copies a file (regular or symlink) from source to destination.
Definition: FsUtil.qm.dox.h:487
copy_file_obj(File source, File destination, bool close=False, int buf_size=DefaultBufferSize)
Copies a file object data from source to destination.
string copy_dir_structure(string source, string destination, *int depth)
Copies a structure of directories, files are ignored.
string move_path(string source, string destination, bool overwrite=False)
Moves a path from source to destination.
hash< TmpFileHash > make_tmp_file(*string prefix, *string suffix, *string path)
Creates and opens a unique temporary file and returns its absolute path as well as its File object.
string merge_tree(string source, string destination, bool follow_symlinks=False, bool overwrite=False, bool fail_immediately=True, *int depth)
Merges a copy of the source directory tree to the destination directory tree.
Definition: FsUtil.qm.dox.h:602
string join_paths()
Returns the path resulting from joining the given paths.
bool path_exists(string path, bool follow_symlinks=False)
Check whether the given path exists or not.
string make_tmp_dir(*string prefix, *string suffix, *string path)
Creates a unique temporary directory and returns its absolute path.
remove_tree(string path, bool fail_immediately=True)
Removes the filesystem tree specified by path.
string merge_path(string source, string destination, bool follow_symlinks=False, bool overwrite=False, bool fail_immediately=True, *int depth)
Universal merge function.
Definition: FsUtil.qm.dox.h:643
remove_file(string path)
Removes a regular file or symlink specified by path.
string copy_tree(string source, string destination, bool follow_symlinks=False, bool overwrite=False, bool fail_immediately=True)
Copies a directory tree from source to destination.
Definition: FsUtil.qm.dox.h:544
string copy_tree_internal(string source, string destination, bool follow_symlinks=False, bool overwrite=False, bool merge=False, bool fail_immediately=True, *int depth)
Private internal copy tree function implementation.
Definition: FsUtil.qm.dox.h:425
string basename_ext(string path, *string extension)
this function returns the segment of given path after the last delimiter
const DefaultBufferSize
Default file block buffer size.
Definition: FsUtil.qm.dox.h:99