[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 18:56, mick crane wrote:
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

Ah Ok, I could assert a directory and then the output directory make
that a subdirectory.
so if they typed "~/"
 "./images_out/~/" would cause an error ?


 a directory called "~/" might be tricky to delete ?

--
Key ID    4BFEBB31


Reply to: