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>
19%>
"Failed to delete <desc> from the local disk. File may be protected."<br>
20%> If the input ``desc`` is empty ``[]`` or empty
string ``
""``, a
default
21%> value ``
"the requested file"``
for ``desc`` will be added to the
template.<br>
22%> (**optional**. If missing, no warning will be displayed upon failure.)
25%> ``failed`` : The output scalar MATLAB logical that is ``
true``
if and
26%> only
if the deletion of the input file fails,
27%> otherwise,
return ``
false``.<br>
32%> failed = pm.sys.path.rmfile(file)
33%> failed = pm.sys.path.rmfile(file, desc)
38%> \include{lineno} example/sys/path/
rmfile/main.m
40%> \include{lineno} example/sys/path/
rmfile/main.out.m
45%> \JoshuaOsborne, May 21 2024, 5:28 AM, University of Texas at Arlington<br>
46%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
47%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
53 if isempty(desc) || desc ==
""
54 desc =
"the requested file";
57 +
string(me.identifier) +
" : " +
string(me.message) + newline ...
58 +
"Failed to delete " +
string(desc) +
" from the local disk." + newline ...
59 +
"An application may possess the file ownership, particularly on Windows." + newline ...
60 +
"You can try manually deleting it at:" + newline ...
62 + pm.io.tab +
string(file) + newline ...
67 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,...