Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 0c97b7a

Browse files
[[ Bug 16111 ]] Fix default location for 'Save' and 'Save As'
The issue was caused by always resolving the initial path - if that initial path is not relative, then the current folder was used Resolving the path should only be done if a relative path is given (that was introducing by implementing the enhancement request 13096
1 parent f0114cd commit 0c97b7a

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

docs/notes/bugfix-16111.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Save As dialog always opens in a folder deep in LiveCode's app bundle

engine/src/ask.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,20 @@ Exec_errors MCAsk::exec_file(MCExecPoint& ep, const char *p_title)
373373

374374
if (!t_error && t_initial != nil)
375375
{
376-
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
377-
t_initial_resolved = MCS_get_canonical_path(t_initial);
378-
if (nil == t_initial_resolved)
379-
t_error == EE_NO_MEMORY;
376+
// We only want to resolve the path if the path is relative (otherwise
377+
// it will be created at the current folder - which is /Applications)
378+
if (strchr(t_initial, '/'))
379+
{
380+
// IM-2014-08-06: [[ Bug 13096 ]] Allow file dialogs to work with relative paths by resolving to absolute
381+
t_initial_resolved = MCS_get_canonical_path(t_initial);
382+
if (nil == t_initial_resolved)
383+
t_error = EE_NO_MEMORY;
384+
}
385+
else
386+
{
387+
// Simply copy the file path
388+
t_initial_resolved = strclone(*t_initial);
389+
}
380390
}
381391

382392
if (!t_error)

0 commit comments

Comments
 (0)