🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ForceDirectories and GetLastError?

#11349
From: Remy Lebeau (TeamB)
Date: Sat, 14 Feb 2004 02:55
26 lines
1907 bytes
"bcb" <noemail@sorry.com> wrote in message
news:402d82e6$1@newsgroups.borland.com...

> I'm trying to use the ForceDirectories function. When trying to
> run the code below and the folder does not already exist this
> message is returned "The System Cannot Find The File Specified"

That is normal.  ForceDirectories() uses DirectoryExists() internally, which
in turn calls GetFileAttributes().  If ForceDirectories() encounters a
folder that does not exist yet, GetFileAttributes() will set the last error
before CreateDir() can be called to create it.

> It maybe the problem that ForceDirectories uses the DirectoryExists
> function wich returns that message "The System Cannot Find The File
> Specified" aswell?

Yes.

> but I'm also wondering why the second piece of code shows
> the same messages when CreateDir is called last

Because the second piece of code is also calling DirectoryExists().


Gambit
Technical Details
Message-ID: <402d8c41$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <402d82e6$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,bd0813bfab1f48b4
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-13 18:59:43 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <402d82e6$1@newsgroups.borland.com>
Subject: Re: ForceDirectories and GetLastError?
Date: Fri, 13 Feb 2004 18:55:11 -0800
Lines: 28
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.138.253
Message-ID: <402d8c41$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1076726849 67.22.138.253 (13 Feb 2004 18:47:29 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!news-hog.berkeley.edu!ucberkeley!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail