[DUG] Check if allowed to save to a location

Phil Middlemiss phil at tumonz.co.nz
Thu Feb 1 15:35:40 NZDT 2007


Ja, deutsch. Sie sind korrekt.

If I can't save to the install folder then I will save it to the user's 
folder. I suppose it may be faster to try saving and then check if it 
failed or not, but that routine is very re-usable and it seems more 
correct to check first anyway. It just avoids any possible confusion 
should the save fail for other reasons.

Cheers,
Phil.

Jeremy North wrote:
> Actually that forum is german.
>
> How often are you expecting it to fail though. Might be quicker to
> just do it and test if it fails. Although I guess if you can't write
> to it and it exists are you then wanting to move it to the profile
> folder?
>
> On 2/1/07, Phil Middlemiss <phil at tumonz.co.nz> wrote:
>> It's not as simple as that. This for updating an installed product that
>> may have been installed by a user with admin privileges but being used
>> and updated by a user.
>>
>> Nevertheless, I have found a lovely bit of code at this link here:
>>
>> http://www.delphipraxis.net/post625364.html
>>
>> but the forum is dutch so I'm not even sure what the name of the person
>> who posted it is!
>>
>> Phil.
>>
>> Jeremy North wrote:
>> > Try it and trap the exception.
>> > Really you should be writing all information to the users profile
>> > directory anyway. Unless you have to support OS versions that don't
>> > support it but you can test for those versions before hand anyway.
>> >
>> > On 2/1/07, Phil Middlemiss <phil at tumonz.co.nz> wrote:
>> >> Hi all,
>> >>
>> >> What is the correct way to determine if my application is allowed to
>> >> write to a particular directory? That is, there are two locations 
>> I want
>> >> to create a file - one is the install directory, which the user 
>> may not
>> >> have write privileges to, and the other is in their Documents and
>> >> Settings which is the second choice of where to save it.
>> >>
>> >> Cheers,
>> >> Phil.
>> >>
>> >> _______________________________________________
>> >> Delphi mailing list
>> >> Delphi at ns3.123.co.nz
>> >> http://ns3.123.co.nz/mailman/listinfo/delphi
>> >>
>> >>
>> >>
>> > _______________________________________________
>> > Delphi mailing list
>> > Delphi at ns3.123.co.nz
>> > http://ns3.123.co.nz/mailman/listinfo/delphi
>> >
>> >
>> >
>>
>>
>> _______________________________________________
>> Delphi mailing list
>> Delphi at ns3.123.co.nz
>> http://ns3.123.co.nz/mailman/listinfo/delphi
>>
>>
>>
>>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phil.vcf
Type: text/x-vcard
Size: 250 bytes
Desc: not available
Url : http://ns3.123.co.nz/pipermail/delphi/attachments/20070201/82efa5be/phil.vcf


More information about the Delphi mailing list