Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Mkdir and several directories at once...
Topic Summary:
Created On: 23-Jun-2005 07:58
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Edwin Buisman, on Friday, June 24, 2005 12:01 PM

Answer:
As ever, Tony has the best solutions! Fixed a small recursive problem...
 23-Jun-2005 07:58
User is offline View Users Profile Print this message


Edwin Buisman

Posts: 38
Joined: 12-Aug-2004

Hello all,

from the reference manual:

void mkdir(string dirName)

Operation

Creates directory dirName.

Optional argument osParm can contain information that is dependent on the operating system, such as the UNIX octal file access mask.

Example
The following example creates a typical UNIX path name, and sets the access rights:

mkdir("/usr/development/phase1", "0755")
The following example creates a Windows path, for which there are no access rights:

mkdir("C:\\DOORS\\DXLExample\\", "")


gives the following message:....

-R-E- DXL: <Line:1> mkdir fails: No such file or directory
C:\DOORS\DXLExample
-I- DXL: execution halted


creating a single directory works...

Does anybody have a solution for this?

Edwin Buisman

Edited: 23-Jun-2005 at 08:41 by Edwin Buisman
Report this to a Moderator Report this to a Moderator
 23-Jun-2005 08:43
User is offline View Users Profile Print this message


Robert Swan

Posts: 86
Joined: 14-Apr-2005

I'm not clear what you are saying the problem is, but all the directories in the path must exist for the create to work. You can't create a path.
So to create C:\DOORS\DXLExample\ you need the attached code.


 

Report this to a Moderator Report this to a Moderator
 23-Jun-2005 08:46
User is offline View Users Profile Print this message


Edwin Buisman

Posts: 38
Joined: 12-Aug-2004

This is what I found as well, but that means that I must parse the directory string. I hoped the function mkdir was intelligent... (As it stated in the reference manual...)

Edited: 23-Jun-2005 at 08:47 by Edwin Buisman
Report this to a Moderator Report this to a Moderator
 23-Jun-2005 11:45
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

Edwin,
I couldn't resist having a go at this one, seemed so useful to have.
The attached implements a wrapper for mkdir.

string makeDir(string dirName)

which allows you to create a whole new directory path, not just a single directory.
It also traps errors for you.

I have tested this, but suggest you test some more.

Interestingly, while testing this I noticed that miss off the drive letter and DOROS assumes it is drive C:.

makeDir("\\Temp\\newDirectory")

worksexactly the same as

makeDir("C:\\Temp\\newDirectory")

makeDir.inc
makeDir.inc  (2 KB)



-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 24-Jun-2005 12:00
User is offline View Users Profile Print this message


Edwin Buisman

Posts: 38
Joined: 12-Aug-2004

Answer Answer
As ever, Tony has the best solutions! Fixed a small recursive problem...
Report this to a Moderator Report this to a Moderator
 24-Jun-2005 13:19
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

Thankyou for the fix Edwin. Two heads are always better than one!

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 0 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.