Article View: borland.public.cppbuilder.nativeapi
Article #11325Re: how to determine the permissions of a folder using XP
From: Roland
Date: Thu, 19 Feb 2004 07:48
Date: Thu, 19 Feb 2004 07:48
43 lines
2496 bytes
2496 bytes
Hello Thomas,
strFileName contains a complete file name which I delete before I call RemoveDir. So the directory is empty. sTest contains then the following String:
F:\\ENTWICK\\Roland\\1Projekte\\DDV_TEST\\incoming\\949\\dd949_01_2004003.20031230_212909
>> AnsiString sTest = ExtractFileDir(strFileName);
>
>Then sTest would probably be the path of the directory containing the file
>named by strFileName.
>
>
>> struct stat statbuf;
>> if (stat(sTest.c_str(),&statbuf)==0)
>> {
>> if (S_ISDIR(statbuf.st_mode))
>> Memo1->Lines->Add(sTest + " is a directory");
>> if (statbuf.st_mode&S_IRUSR)
>> Memo1->Lines->Add("owner has read permission");
>> if (statbuf.st_mode&S_IWUSR)
>> Memo1->Lines->Add("owner has write permission");
>> if (statbuf.st_mode&S_IXUSR)
>> Memo1->Lines->Add("owner has execute permission");
>
......
>>
>> if(RemoveDir(sTest))
>
>All these permissions are not sufficient for removing this directory.
I think so too.
>Removing a file system element (directory, file) does not change the element
>itself, but the directory *that contains it*. Does the user have the necessary permissions for that directory?
This seems to be the question, how determine it? I am able to remove the dir using the explorer, so I think I have all rights. Thats the reason I postet it, why is RemoveDir not able to delete it.
By the way the error code of GetLastError is 0x00000005.
Roland
Technical Details
Message-ID:
<40346a5d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<402c98a1$1@newsgroups.borland.com> <m2hdxu6gm3.fsf@madbox2.local> <m2ekstsfvi.fsf@madbox2.local>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,ce8d67f0062a8486 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-02-18 23:56:28 PST From: "Roland" <neubert@wst-gmbh.de> Sender: "Roland" <neubert@wst-gmbh.de> Reply-To: "Roland" <neubert@wst-gmbh.de> Subject: Re: how to determine the permissions of a folder using XP Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 62.180.198.197 References: <402c98a1$1@newsgroups.borland.com> <m2hdxu6gm3.fsf@madbox2.local> <m2ekstsfvi.fsf@madbox2.local> NNTP-Posting-Host: 207.105.83.66 Message-ID: <40346a5d$1@newsgroups.borland.com> Date: 18 Feb 2004 23:48:45 -0800 X-Trace: newsgroups.borland.com 1077176925 207.105.83.66 (18 Feb 2004 23:48:45 -0800) Lines: 44 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail