🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

ForceDirectories and GetLastError?

#11348
From: bcb
Date: Sat, 14 Feb 2004 02:07
32 lines
2032 bytes
Hello :)

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" but the folder is created, when the
button is clicked a second time this is the message returned "The Operation
Completed Successfully"

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  ForceDirectories("c:\\test");

  Application->MessageBox(SysErrorMessage(GetLastError()).c_str(), "",
MB_OK);
}

this code shows the same behavior

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  if  ( !DirectoryExists("c:\\test") )
  CreateDir("c:\\test");

  Application->MessageBox(SysErrorMessage(GetLastError()).c_str(), "",
MB_OK);
}

It maybe the problem that ForceDirectories uses the DirectoryExists function
wich returns that message "The System Cannot Find The File Specified"
aswell?  but I'm also wondering why the second piece of code shows the same
messages when CreateDir is called last, perhaps it doesn't work with
GetLastError. I've also tried ::GetLastError().
Technical Details
Message-ID: <402d82e6$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,bd0813bfab1f48b4,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-13 18:09:34 PST
From: "bcb" <noemail@sorry.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: ForceDirectories and GetLastError?
Date: Fri, 13 Feb 2004 21:07:39 -0500
Lines: 40
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: 24.184.196.112
Message-ID: <402d82e6$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1076724454 24.184.196.112 (13 Feb 2004 18:07:34 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail