Issue 103886

Summary: BASIC - CurDir function
Product: Calc Reporter: djmoo28 <de28jihem>
Component: programmingAssignee: spreadsheet <spreadsheet>
Status: CLOSED DUPLICATE QA Contact: issues@sc <issues>
Severity: Trivial    
Priority: P3 CC: issues, lohmaier, raal, rb.henschel
Version: OOo 1.0.0Keywords: oooqa
Target Milestone: ---   
Hardware: All   
OS: Windows XP   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description djmoo28 2009-07-29 22:49:04 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.
Comment 1 raal 2009-08-02 21:14:00 UTC
I can confirm with DEV300m53.
CurDir returns installation directory.
Comment 2 Regina Henschel 2009-08-02 21:41:04 UTC
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
Comment 3 raal 2009-08-03 13:23:28 UTC
workaround, try this code in basic:

Doc = ThisComponent
FullPathURL = Doc.Location
msgbox FullPathURL
FullPath = convertFromURL(FullPathURL)
msgbox FullPath
Comment 4 lohmaier 2010-06-15 12:47:37 UTC
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 ***
Comment 5 lohmaier 2010-06-15 12:48:47 UTC
closing