CurrentDirectory broken? - Сообщения
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?
why isn't the proper directory showing up?

- 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.
WroteIs the CurrentDirectory function still broken? Looking at https://smath.com/bts/Issues/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().
WroteThis 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.
-
Новые сообщения
-
Нет новых сообщений