[SAGA-RG] Some more questions
Ceriel Jacobs
ceriel at cs.vu.nl
Wed Oct 31 08:36:34 CDT 2007
'Andre Merzky' wrote:
> Hi,
>
> Quoting [Hartmut Kaiser] (Oct 30 2007):
>>
>> Andre,
>>
>>>> 2. What is supposed to happen when the source is a directory, the
>>>> recursive flag is set, and the target is a file? I assume remove
>>>> target, create target dir, and copy? And if overwrite flag is
>>>> not set, throw AlreadyExists?
>>> Uhm, tough one! Unix shell would say:
>>>
>>> koks merzky /tmp : mkdir a
>>> koks merzky /tmp : touch a/a b
>>> koks merzky /tmp : cp -Rf a b
>>> cp: cannot overwrite non-directory `b' with directory `a'
>>>
>>> We don't have an exception for this. So, yes, I would concur
>>> with your interpretation: the target file should get removed,
>>> and a target dir with the same name should get created.
>> Deleting a file in the case the user wanted to delete a directory is bad,
>> IMHO. I'ld suggest to throw an AlreadyExists exeption.
>
> It would be nice to get another opinion to break the tie (I
> myself am not sure which way is better).
OK, I thought about this now. Here is My opinion:
I agree with Hartmut: throw an AlreadyExists exception, with a
clarifying message, like "cannot overwrite non-directory `b' with directory `a'".
I agree that deleting the file is a bad idea. If the user wants this,
he/she should remove the file first.
Ceriel
More information about the saga-rg
mailing list