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: Type of 'directory'
Topic Summary:
Created On: 20-Dec-2005 20:27
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.
 20-Dec-2005 20:27
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

In chapter Files and Streams there is a "for NameFile in directory(NameDir) do" loop. Does anybody know what type of data is a "directory(NameDir)", such that I can do this:
?DefineDir? dir = directory(NameDir)
if (null dir)
then its not a directory
else look at the files in the directory.

- Louie
Report this to a Moderator Report this to a Moderator
 20-Dec-2005 22:03
User is offline View Users Profile Print this message


Chris Jones

Posts: 177
Joined: 1-Jul-2005

Are you just trying to find out if something is a directory? If so, there's the stat type, and a function directory() that gives a boolean back.

Example from the manual:

Stat s
string filename = "/etc"
s = create filename
if (!null s && directory s)
ack filename " is a directory!"

Or maybe you're talking about something else .

-Chris
Report this to a Moderator Report this to a Moderator
 21-Dec-2005 10:01
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

There are two forms of the directory perm:

Directory__ directory(string) // thats a double underscore

bool directory(Stat)

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 21-Dec-2005 22:39
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Directory__ works thanks. I can set it and check whether or not its null. This gives the same results as Jones.

But WAIT!!! This doesn't really work. If the directoryname is "D:\" then both the above schemes return true whether or not you've got a CD in the drive. So what I was really after is "Is it a directory to which I can see the contents". That hokey algorithm looks as follows:
noError()
for NameFile in directory(NameDir) do
{ break
}
string ErrMess = lastError()
// Its a directory if there was no DXL error.
if (!null ErrMess) print "\t" NameDir "\t" ErrMess
IsaDir = (null ErrMess) // that's not "Isuldur"

- Louie
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 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 1 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.