Jump to content
Developer Wiki and Function Reference Links ×

How to get the file path name


JackhBSC

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!

Link to comment

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

Link to comment

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!

Link to comment

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);

Link to comment

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

Link to comment

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 _c_
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...