Re: need native call help

[email protected] (ToddAndMargo via perl6-users)
Newsgroups perl.perl6.users
Message-ID <[email protected]>
On 4/17/24 05:52, yary wrote:
>  From unlink's documentation:
> 
> If the file to be deleted does not exist, the routine treats it as success.
> 
> So trying to delete a file that isn't there, doesn't have an error, 
> which is kind of neat, but that is a difference from native delete.
> 
> -y


Hi Yary,

Not neat at all.  And that would be a bug that need
to be fixed.  I spend hours trying to troubleshoot
why I could not delete a file.

1) it should return "File not Found"

and

2) it should return "MAX_PATH exceed in file name"
if that is the case and `\\?\` has not been prepended.
And if such, recommend adding `\\?\`.  Or just
add it automatically as my ApiDeleteFile module
does.


This is Windows we are dealing with after all.

Oh look how it is done in Linux when deleting a
non-existent file:

$ rm abc.txt ; echo $?
rm: cannot remove 'abc.txt': No such file or directory
1

The "No such file or directory" is self explanatory.

The "1" from the echo of "$?" means the command failed,
unlike the no error return from Raku's unlink.  Unlink
need to be fixed.

-T
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.