Re: [R-pkg-devel] creating indelible file during unit test

2017-12-14 Thread Thierry Onkelinx
Thanks for the replies to my question. My function uses first list.files() to select the relevant files and then file.remove() to delete them. Redefining file.remove() doesn't work in case of a package due to lexical scoping. Otherwise this would be a simple and portable solution. Having a Linux

Re: [R-pkg-devel] creating indelible file during unit test

2017-12-12 Thread Tom Wainwright
In *nix systems, permission to delete is at the directory level, not the file level, so you might try changing the mode of the parent directory, rather than the file itself, as in: > dir.create('test') > > file.create(file.path("test",'file1')) > [1] TRUE > > Sys.chmod("test", mode="") > > fil

Re: [R-pkg-devel] creating indelible file during unit test

2017-12-12 Thread Iñaki Úcar
2017-12-12 15:47 GMT+01:00 Barry Rowlingson : > I think unix makes it impossible for you to create something that even you > can't delete. You may need higher powers ("root") to change the ownership > of the thing you've created. In a Unix system with administrator rights, you can set the immutabl

Re: [R-pkg-devel] creating indelible file during unit test

2017-12-12 Thread Barry Rowlingson
On Tue, Dec 12, 2017 at 12:24 PM, Thierry Onkelinx wrote: > Dear all, > > Some function I wrote deletes a bunch of files. It is crucial that all > files get deleted. Hence it should return an error when one or more > files couldn't be deleted. > > I'm writing a unit test for this function. I fail

Re: [R-pkg-devel] creating indelible file during unit test

2017-12-12 Thread Iñaki Úcar
2017-12-12 13:24 GMT+01:00 Thierry Onkelinx : > Dear all, > > Some function I wrote deletes a bunch of files. It is crucial that all > files get deleted. Hence it should return an error when one or more > files couldn't be deleted. > > I'm writing a unit test for this function. I fail to create a f

[R-pkg-devel] creating indelible file during unit test

2017-12-12 Thread Thierry Onkelinx
Dear all, Some function I wrote deletes a bunch of files. It is crucial that all files get deleted. Hence it should return an error when one or more files couldn't be deleted. I'm writing a unit test for this function. I fail to create a file that can't be deleted by the function. I've tried Sys.