OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Path to default Application & Data folders

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
MacZap
General User
General User


Joined: 18 Nov 2006
Posts: 23

PostPosted: Sun May 27, 2012 1:38 pm    Post subject: Path to default Application & Data folders Reply with quote

Hi all,

I need to get the path to the Application folder (the default folder in wich the applications are stored) and to the Data folder (the default folder for user data).

Please note that I need to reach these folders in all the OS: Windows, MacOSX and Linux, and that I use OOo Basic for my macros.

Some suggestions?
Back to top
View user's profile Send private message
patel
Power User
Power User


Joined: 14 Apr 2012
Posts: 54
Location: Italy

PostPosted: Sun May 27, 2012 9:30 pm    Post subject: Reply with quote

Code:
sub paths
Dim oPathSettings
oPathSettings = CreateUnoService("com.sun.star.util.PathSettings")
s$ = oPathSettings.Work ' user documents path
print s$
print curdir ' application dir
print thiscomponent.geturl() ' current document
sInitPath = ConvertToUrl(CurDir)
print sInitPath
Print Environ("PATH")
Print Environ("TEMP")
end sub

_________________
If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button).
Back to top
View user's profile Send private message
MacZap
General User
General User


Joined: 18 Nov 2006
Posts: 23

PostPosted: Sun Jul 01, 2012 12:44 am    Post subject: Reply with quote

Thanks, but your code doesn't fully solves my problem.
Under OSX, I get the data path but not where the application is stored.
It seems something is missing in your code, because 'curdir' is an empty variable…

Some other suggestions?
Back to top
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1453
Location: France

PostPosted: Mon Jul 02, 2012 3:55 am    Post subject: Reply with quote

Hi,
CurDir is an obsolete Basic instruction.
These strings may be what you need:
Code:
Dim oPathSettings
oPathSettings = CreateUnoService("com.sun.star.util.PathSettings")
MsgBox(oPathSettings.Module ,0, "OpenOffice program address")
MsgBox(oPathSettings.UserConfig ,0, "OpenOffice user data address")
MsgBox(oPathSettings.Work ,0, "Address of My Documents")
MsgBox(oPathSettings.Temp ,0, "Temporary data folder address")

_________________
Bernard

OpenOffice.org 1.1.5 fr / Apache OpenOffice 4.0.1 / LibreOffice 4.1.0
MS-Windows 7 Home SP1
This forum is spammed, use instead Apache OpenOffice forums
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group