Recent

Author Topic: RunError(3)  (Read 12670 times)

PeterATC

  • New Member
  • *
  • Posts: 12
RunError(3)
« on: December 12, 2010, 12:36:15 am »
Hi all,
I am using Lazuras in Windows 7. I have a piece of code to create a directory. I am allocating the string variable which I then use in the mkdir function but it returns a runError(3)

the code segment is

strTemp := strCustomeLocation + '\bogeys' + strAssetName + '_bogey';
mkDir(strTemp);


the strTemp is 'C:\Program Files (x86)\Auran\TRS2006\bin\world\Custom\bogeys\Test_bogey'

If someone can tell me what runerror(3) means or possibly what I am doing wrong. This code worked fine in Delphi 7

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: RunError(3)
« Reply #1 on: December 12, 2010, 02:35:12 am »
Runtime error 3 would mean that the path is invalid. Make sure it really exists. Maybe like this:

at command line: cd "C:\Program Files (x86)\Auran\TRS2006\bin\world\Custom\bogeys"

Also, I assume you have write access to that folder, right?

Thanks.

-Phil

PeterATC

  • New Member
  • *
  • Posts: 12
Re: RunError(3)
« Reply #2 on: December 12, 2010, 02:59:50 am »
Hi Phil,
yes in can cd to the directory and have also checked the write access. I actually have the code running Delphi 7 but i am trying to port it to lazarus.

Peter

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: RunError(3)
« Reply #3 on: December 12, 2010, 03:15:21 am »
From FPC's user.pdf:

"3 Path not found Reported by the directory handling routines when a path does not exist or is in- valid. Also reported when trying to access a non-existent file."

Try a simpler example to somewhere that you know you can write to, like a folder below where your .exe is.

Thanks.

-Phil

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12514
  • Debugger - SynEdit - and more
    • wiki
Re: RunError(3)
« Reply #4 on: December 12, 2010, 03:46:57 am »
What happens if you explicitly put the line:

strTemp := ' 'C:\Program Files (x86)\Auran\TRS2006\bin\world\Custom\bogeys\Test_bogey'';
mkDir(strTemp);

in your source code?

How is strTemp declared?
string => do you use {$mode delphi} or {$mode objfpc} or {$H+} or {$H-} ?
shortstring
ansistring
widestring

If you string is read from an external file, maybe it is encoded as utf16/ucs2 (16bit) and your string type is utf8 (ansistring) or vice versa?

PeterATC

  • New Member
  • *
  • Posts: 12
Re: RunError(3)
« Reply #5 on: December 13, 2010, 01:02:08 am »
Okay think i found the issue. I am trying to create a directory and a sub directory with a single command and it is not possible. Thnks for the advice..

peter

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: RunError(3)
« Reply #6 on: December 13, 2010, 01:07:07 am »
You can use ForceDirectories to do that.

Thanks.

-Phil

 

TinyPortal © 2005-2018