Port OS.File move/rename to C++
Categories
(Toolkit Graveyard :: OS.File, task)
Tracking
(firefox80 fixed)
Tracking | Status | |
---|---|---|
firefox80 | --- | fixed |
People
(Reporter: mail, Assigned: mail)
References
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
Part of larger work to port OS.File to C++, we need a static method in the IOUtils interface which can move/rename files.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
This patch introduces a move method to the IOUtils interface, which allows
for renaming/moving files or directories on disk. Source and destination
files may be specified either by an absolute path, or a relative path from
the current working directory.
This method mimics the behaviour of the POSIX mv command and has
well-defined behaviour (regardless of whether the source
or destination is a file or directory), briefly summarized below:
-
If the source is a file that exists:
a. If the destination is a file that does not exist, but whose parent
directory does exist, the source is renamed (and re-parented as a
child of the destination parent directory).
b. If the destination is a file that does exist, the destination is
replaced with the source (unless the noOverwrite option is true). -
If the source is a directory that exists:
a. If the destination is a directory, then the source directory is
re-parented such that it becomes a child of the destination.
b. If the destination does not exist, then the source is renamed.
c. If the destination is a file, then an error occurs. -
If the source does not exist, an error occurs.
Assignee | ||
Updated•4 years ago
|
Comment 3•4 years ago
|
||
Backed out for bustage on IOUtils.cpp
backout: https://hg.mozilla.org/integration/autoland/rev/cfd5ede7df08452c898256f40dc3c90697689b5a
failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=309786446&repo=autoland&lineNumber=10162
[task 2020-07-14T20:06:05.021Z] 20:06:05 INFO - In file included from Unified_cpp_dom_system0.cpp:2:0:
[task 2020-07-14T20:06:05.026Z] 20:06:05 INFO - /builds/worker/checkouts/gecko/dom/system/IOUtils.cpp: In function 'nsCString mozilla::dom::FormatErrorMessage(nsresult, const char*)':
[task 2020-07-14T20:06:05.026Z] 20:06:05 ERROR - /builds/worker/checkouts/gecko/dom/system/IOUtils.cpp:100:54: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'nsresult' [-Werror=format=]
[task 2020-07-14T20:06:05.026Z] 20:06:05 INFO - return nsPrintfCString("%s: 0x%x", aMessage, aError);
[task 2020-07-14T20:06:05.026Z] 20:06:05 INFO -
Assignee | ||
Comment 5•4 years ago
|
||
The bustage should be fixed now, sorry about that.
Comment 6•4 years ago
|
||
bugherder |
Updated•1 years ago
|
Description
•