[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: not wanting to delete somebody's home directory



On 2019-07-05 17:31, songbird wrote:
mick crane wrote:
hello,
I doing some code in perl and I'm not very good at it.
code makes some images and saves them to a directory.
If the directory doesn't exist it gets made and if it does exist all the
files in it get deleted before putting some new ones in.
I'm thinking that if I ever give it to somebody it's possible they might
call the directory
"~/" or something and end up deleting all their files, which I'd like to
avoid.
How would that best be avoided ?
Is that something to do with chroot which I don't know anything about.

  always put things in a subdirectory.

  there is normally a directory named .local/share/<program-name>/
used for such things (or create it if it isn't there).

  if you have any configuration information that can be saved in
the .config/<program-name>/ directory (or again create it if it
isn't there).


  songbird

I'm incrementing the number by the loop and some software sees 2 as bigger that 10 or something like this. I can probably get around that by adding to a very large number in the loop and calling them that. I don't mind deleting them by hand but if I have to run program several times to tweak what images look like it slows things down. I was interested though if there was some instruction to put at the top of the file to make perl think that the directory the file was in was "/"

mick


--
Key ID    4BFEBB31


Reply to: