Rank: Advanced Member Groups: Registered
Joined: 12/03/2011(UTC) Posts: 101 Location: Chicago
Was thanked: 16 time(s) in 7 post(s)
|
Is the CurrentDirectory function still broken? Looking at https://smath.com/bts/Is...IssueDetail.aspx?id=4586 its unresolved? I am on 0.99.7579.3197 No matter where I save the .sm file, it ALWAYS returns "C:\Program Files (x86)\SMath Studio\" This breaks many of my include statements and excel file imports/exports as I have them defined as - path:= "xls\workbook.xlsm" root_dir:=CurrentDirectory("" and then path:= concat(root_dir,path) will return "C:\Program Files (x86)\SMath Studio\xls\workbook.xlsm" instead of "C:\Users\someguy\JobFolder\xls\workbook.xlsm" I know that this has come and gone a few times with both uni and AlexM weighing in on it, but I thought it was fixed. Is there a fix? Edited by user 30 October 2020 10:33:39(UTC)
| Reason: Not specified |
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
CurrentDirectory() is just a wrapper for the system variable Environment.CurrentDirectory (.Net). So it can't be broken. With an empty argument, it shows the current folder specified in the program and nothing else. |
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 12/03/2011(UTC) Posts: 101 Location: Chicago
Was thanked: 16 time(s) in 7 post(s)
|
uni- why isn't the proper directory showing up? |
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
It looks like SMath Studio doesn't change the folder when saving the document. I addressed this question to Andrey. Let's wait for his answer. |
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Administration Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member Joined: 11/07/2008(UTC) Posts: 1,616 Was thanked: 1978 time(s) in 666 post(s)
|
If it is based on Environment.CurrentDirectory then result will differ according to the way how you have opened SMath Studio: - If opened clicking on program icon - current directory will be equal to SMath Studio installation directory; - If opened clicking on the Worksheet file - current directory is a folder where file is located.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
Originally Posted by: sinneD Is the CurrentDirectory function still broken? Looking at https://smath.com/bts/Is...IssueDetail.aspx?id=4586 its unresolved? I am on 0.99.7579.3197 No matter where I save the .sm file, it ALWAYS returns "C:\Program Files (x86)\SMath Studio\" This breaks many of my include statements and excel file imports/exports as I have them defined as - path:= "xls\workbook.xlsm" root_dir:=CurrentDirectory("" and then path:= concat(root_dir,path) will return "C:\Program Files (x86)\SMath Studio\xls\workbook.xlsm" instead of "C:\Users\someguy\JobFolder\xls\workbook.xlsm" I know that this has come and gone a few times with both uni and AlexM weighing in on it, but I thought it was fixed. Is there a fix? I recommend to use CurrentDirectory(DocumentDirectory()). This should work for files which have been saved at least once. What it does is quite straightforward. It gets the directory of the currently active document and sets the current directory to it. Both functions are from Uni's mathcad file access functions plugin. This way you can have multiple documents open at the same time. When switching between them, the directory is changed once you execute the document. In your case you could set the root to DocumentDirectory(). Edited by user 31 October 2020 12:26:10(UTC)
| Reason: Not specified |
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 05/06/2014(UTC) Posts: 348 Location: Colombo Was thanked: 125 time(s) in 82 post(s)
|
Originally Posted by: mkraska I recommend to use CurrentDirectory(DocumentDirectory()). This should work for files which have been saved at least once.
Image of an example attached pl. Works fine in latest SS. Edited by user 31 October 2020 17:03:48(UTC)
| Reason: Not specified |
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 12/03/2011(UTC) Posts: 101 Location: Chicago
Was thanked: 16 time(s) in 7 post(s)
|
Originally Posted by: mkraska This way you can have multiple documents open at the same time. When switching between them, the directory is changed once you execute the document.
In your case you could set the root to DocumentDirectory(). Exactly. Thank you. |
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.