2%> Return a scalar MATLAB logical that is ``
true``
if and
3%> only
if the deletion of the input file fails,
4%> otherwise,
return ``
false``.<br>
7%> This function is a simple wrapper around the MATLAB function ``
delete()``.<br>
8%> It is primarily meant to bring consistency to messaging file deletions
if they fail.<br>
9%> Such consistency is particularly required on Windows systems
10%> as the OS tends to lock file ownership to one application
11%> causing deletions to fail frequently.<br>
13%> \param[in] file : The input scalar MATLAB
string,
14%> containing the file path to be deleted.<br>
15%> \param[in] desc : The input scalar MATLAB
string, containing a descriptive message
16%> to be printed on the MATLAB command line
if the deletion task fails.<br>
17%> The input ``desc``,
if not empty, will be added to the following
template
18%> before being displayed:<br>
20%>
"Failed to delete <desc> from the local disk. File may be protected."<br>
22%> If the input ``desc`` is empty ``[]`` or empty
string ``
""``, a
default
23%> value ``
"the requested file"``
for ``desc`` will be added to the
template.<br>
24%> (**optional**. If missing, no warning will be displayed upon failure.)
27%> ``failed`` : The output scalar MATLAB logical that is ``
true``
if and
28%> only
if the deletion of the input file fails,
29%> otherwise,
return ``
false``.<br>
34%> failed = pm.sys.path.rmfile(file)
35%> failed = pm.sys.path.rmfile(file, desc)
40%> \include{lineno} example/sys/path/
rmfile/main.m
42%> \include{lineno} example/sys/path/
rmfile/main.out.m
47%> \JoshuaOsborne, May 21 2024, 5:28 AM, University of Texas at Arlington<br>
48%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
49%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
55 if isempty(desc) || desc ==
""
56 desc =
"the requested file";
59 +
string(me.identifier) +
" : " +
string(me.message) + newline ...
60 +
"Failed to delete " +
string(desc) +
" from the local disk. File may be protected." + newline ...
61 +
"An application may possess the file ownership, particularly on Windows." + newline ...
62 +
"You can try manually deleting it at:" + newline ...
64 + pm.io.tab +
string(file) + newline ...
69 failed = isfile(file);
function rmfile(in file, in desc)
Return a scalar MATLAB logical that is true if and only if the deletion of the input file fails,...