Apache OpenOffice (AOO) Bugzilla – Issue 103886
BASIC - CurDir function
Last modified: 2010-06-15 12:48:47 UTC
In OO 2.2 the CurDir function in BASIC returned the directory where the spreadsheet was "launched". In OO 3.x (and I think also in 2.3/2.4) it returns the product installation directory ! This impairs all applications relying on relative pathnames based on the "launch" directory.
I can confirm with DEV300m53. CurDir returns installation directory.
From the application help: "This runtime statement currently does not work as documented. See this* issue for more information." * http://www.openoffice.org/issues/show_bug.cgi?id=30692
workaround, try this code in basic: Doc = ThisComponent FullPathURL = Doc.Location msgbox FullPathURL FullPath = convertFromURL(FullPathURL) msgbox FullPath
It prints the current directory of the OOo-process. When on linux you start OOo from the directory /home/user/somedir , then CurDir() will return /home/user/somedir Otherwise, when starting from the menu, it will by default run with the users's home directory as context (/home/user) On Windows, this directory, the directory that the program sees as its current directory is the Applications' directory. (As the other issue is so old, it could be a change in window's behaviour, not OOo) But I think it is simply the quickstarter that causes this: When the quickstarter is running, that one determins the directory, as further OOo- instances just use the quickstarter... I cannot see applications that would rely on the launch directory (that would /need/ to know the launch directory) - I'm pretty sure there are alternative ways to handle it, like getting the path from the opened document and similar. Anyway - duplicate. curDir gives the application's context, i.e. subprocesses called (for example with the shell function) from within OOo will have that same dir as current directory, and that is defined on application start and cannot be changed afterwards. This makes the issue a duplicate to 30692 and thus very, very likely "wontfix". For your case, as you don't want to change it, but have it set to launch directory: Try to disable the quickstarter, maybe that helps in your szenario. *** This issue has been marked as a duplicate of 30692 ***
closing