🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10623

Re: Windows temp dir problem

#10623
From: Bob Gonder
Date: Thu, 01 Apr 2004 04:33
28 lines
2069 bytes
Martin C wrote:

>The problem I am facing is that the temp directory contents never get
>erased, although when I try to delete them manually they get deleted
>normally! So can someone please tell me where is my mistake exactly

Not exactly, no, but can point to some places for you to look.

>bool __fastcall TForm1::EraseAllFolderContents(const AnsiString &Folder,
>const AnsiString &MaskToFind)
>{ //erase all contents of the folder
>
>        String sFullPath, sFindFilter, sCurrentFolder;

Wondering why you use _both_ AnsiString and String.  I'd think you'd
pick _one_ and stick to it.

>                    Result = SetFileAttributes(sFullPath.c_str(),
>wfd.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY);
>                    if(!Result)
>                        break;

This stops the delete on the first "file" that you can't change.
You might want to check GetLastError to find out why, and also display
sFullPath to make sure what your program is trying to do.

For testing, it'd be good to pop up a message box showing your
sFullPath for every Find.
Technical Details
Message-ID: <gn5n6015f7dmu1k4utbve6nau1poucv430@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <406b7a09$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,c9cba57ee1c8629d
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-03-31 20:39:30 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Windows temp dir problem
Date: Wed, 31 Mar 2004 20:33:16 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <gn5n6015f7dmu1k4utbve6nau1poucv430@4ax.com>
References: <406b7a09$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.176.62
X-Trace: newsgroups.borland.com 1080793996 67.31.176.62 (31 Mar 2004 20:33:16 -0800)
Lines: 30
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail