| View previous topic :: View next topic |
| Author |
Message |
MacZap General User

Joined: 18 Nov 2006 Posts: 21
|
Posted: Sun May 27, 2012 1:38 pm Post subject: Path to default Application & Data folders |
|
|
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 |
|
 |
patel Power User

Joined: 14 Apr 2012 Posts: 54 Location: Italy
|
Posted: Sun May 27, 2012 9:30 pm Post subject: |
|
|
| 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 |
|
 |
MacZap General User

Joined: 18 Nov 2006 Posts: 21
|
Posted: Sun Jul 01, 2012 12:44 am Post subject: |
|
|
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 |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1414 Location: France
|
Posted: Mon Jul 02, 2012 3:55 am Post subject: |
|
|
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 / OpenOffice.org 3.4.1 en-US + langpacks, MS-Windows XP Home SP3
This forum is unusable, use instead Apache OpenOffice forums |
|
| Back to top |
|
 |
|