Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
Who's Online
1 user(s) are online (1 user(s) are browsing Forum)

Members: 0
Guests: 1

more...

Browsing this Thread:   1 Anonymous Users





how to get current file path WBArg struct

Joined:
2009/6/30 23:24
Group:
Member
Posts: 60
Offline
Hi

I'm playing with C again and a need to get full path of clicked file.

I found this sample how to read workbench argument
WBArg->wa_Name

gives me only file name. How to get a full path?

--edit

I found this https://en.wikibooks.org/wiki/Aros/Dev ... r/Docs/Libraries/DOS#Lock and now i can read path from
WBArg->wa_Lock

Posted on: 3/9 10:23

Edited by mordesku on 2017/3/9 22:55:32
Edited by mordesku on 2017/3/9 23:01:31
Edited by mordesku on 2017/3/9 23:02:34
Transfer the post to other applications Transfer


Re: how to get current file path WBArg struct

Joined:
2009/10/28 4:25
From Finland
Group:
Member
Posts: 237
Offline
To translate the WBArg into a full path you can do:
TEXT fullpath[1024];

NameFromLock(WBArg->wa_Lockfullpathsizeof(fullpath));
AddPart(fullpathWBArg->wa_Namesizeof(fullpath));


However generally it's more efficient to just do:
BPTR oldcdfile;

oldcd CurrentDir(WBArg->wa_Lock);
file Open(WBArg->wa_NameMODE_OLDFILE);
CurrentDir(oldcd);

if (
file != 0) {
    
/* ... */
    
Close(file);
}

Posted on: 3/10 2:43
Transfer the post to other applications Transfer


Re: how to get current file path WBArg struct

Joined:
2009/6/30 23:24
Group:
Member
Posts: 60
Offline
Quote:
To translate the WBArg into a full path you can do

Thanks for explainig it worked like a charm :)

Posted on: 3/10 12:25
Transfer the post to other applications Transfer






You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]


Search
Top Posters
1 paolone
paolone
4280
2 magorium
magorium
4095
3 phoenixkonsole
phoenixkonsole
3887
4 nikolaos
nikolaos
3670
5 deadwood
deadwood
2923
6 ncafferkey
ncafferkey
2572
7 mazze
mazze
2200
8 clusteruk
clusteruk
2055
9 Kalamatee
Kalamatee
2010
10 damocles
damocles
1789
© 2004-2017 AROS Exec