Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
JackhBSC

How to get the file path name

Recommended Posts

To anyone who might know this i am building a data stamp and i want to get the full file path for the active document. I can get the file name (GetFName) and i can get the file path of the application (GetFolderPath (1)) but i can't seem to get the full file path name.

Help!

Share this post


Link to post

Hi Jack,

???Have you tried GetFileInfo()? It was introduced in v12.

From the VSFR:

PROCEDURE GetFileInfo

(???filename :STRING;

????VAR fullReadPath :STRING;

????VAR fullWritePath :STRING;

????VAR readFileExists :BOOLEAN;

????VAR writeFileExists :BOOLEAN;

????VAR locked :BOOLEAN;

????VAR hasReadPermission :BOOLEAN;

????VAR hasWritePermission :BOOLEAN;

????VAR hasFolderPermission :BOOLEAN

) ;

Raymond

Share this post


Link to post

Raymond,

yeah, I saw that but for some reason i am having trouble getting it to work.

Currently i have within the script:

dateValue := Date(dateFormat, infoFormat);

docName := GetFileInfo (filename : GetFName ; FullWritePath);

GetVersion(vMaj, vMin, vMai, vPlat);

But i have tried all sorts without much success

My knowledge on this is limited son any help very much apreciated!

Share this post


Link to post

Hi Jack,

???This won't do exactly what you want, but it will compile, it will run and it will show the values it collects.

Raymond

PROCEDURE xxx;

CONST

??????CR = chr(13);??????{ Carriage Return }

VAR

??????dateValue, filename, fullReadPath, fullWritePath :String;

??????readFileExists, writeFileExists, locked, hasReadPermission, hasWritePermission, hasFolderPermission :Boolean;

??????vMaj, vMin, vMai, vPlat :Integer;

BEGIN

??????dateValue := Date(1, 0);??????{ Abbreviated Date, Date Only }

??????GetFile(filename);

??????GetFileInfo(filename, fullReadPath, fullWritePath,

????????????????????????readFileExists, writeFileExists, locked, hasReadPermission, hasWritePermission, hasFolderPermission);

??????GetVersion(vMaj, vMin, vMai, vPlat);

??????AlrtDialog(concat(dateValue, CR, 'Major = ', vMaj, ' Minor = ', vMin, ' Maintenance = ', vMai, ' Platform = ', vPlat));

??????AlrtDialog(concat(filename, CR, fullReadPath, CR, fullWritePath, CR, readFileExists, ' ', writeFileExists, ' ', locked, ' ', hasReadPermission, ' ', hasWritePermission, ' ', hasFolderPermission));

END;

Run(xxx);

Share this post


Link to post

Raymond, no.

GetFPathName is rather faulty on Mac and cannot be recommended.

Please see the notes in:

Charles' VSFR

then search for GetFPathName

It also returns posix path on VW13 and path with colons on VW14.

orso

Share this post


Link to post

orso,

Though all you say is true, knowing these shortcomings, one can program around the problems, or avoid them altogether. Even partially impaired, the function works for a majority of cases. For my own uses, the function works quite well enough and I would not avoid using it. I don't think any of the problems are critical enough to not recommend it. Just use it with caution - Caveat Scriptor.

Raymond

Share this post


Link to post

Yes, I have stopped using it because of the diacriticals, a concrete problem in Germany. But the 28 chars limit is actually worse.

To be grim no end, also GetFileInfo is quirky enough. We were discussing this together with Conrad P. There are different behavior between versions in the returned read path. And across platform.

So Raymond, indeed all this is only a trouble for paranoids, people who needs to develop across versions and across platforms and operates on resources and file paths.

Who do you know? :)

ciao, R?

PS

Actually GetFPathName is the only bridge to the "saved status" of a file, at least the only secure. But win only.

There is up to VW14 no *completely* secure way to establish if a file has been saved already or not on Mac up to VW14, because of the bugs in GetFPathName.

Edited by orso b. schmid

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×