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

Commit

Permalink
Auto-merge pull request #5882 from runrevmark/bugfix-20282_develop
Browse files Browse the repository at this point in the history
[[ Bug 20282 ]] Ensure 'the engine folder' returns a LiveCode path (develop)

This patch changes the implementation of fetching the engine folder
to be consistent with how 9+ computes MCcmd. In particular, it uses
the filename of the module containing the engine rather than the
global executable module.

Note: This is based on #5881 from develop-8.1 - that should be merged up before merging this PR.
  • Loading branch information
livecode-vulcan committed Aug 31, 2017
2 parents f347d80 + 7a06fbc commit 53f641c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/notes/bugfix-20282.md
@@ -0,0 +1 @@
# Ensure 'the engine folder' returns a LiveCode path on Windows
13 changes: 7 additions & 6 deletions engine/src/dskw32.cpp
Expand Up @@ -1945,12 +1945,13 @@ struct MCWindowsDesktop: public MCSystemInterface, public MCWindowsSystemService
else if (MCNameIsEqualTo(p_type, MCN_engine, kMCCompareCaseless)
|| MCNameIsEqualTo(p_type, MCN_resources, kMCCompareCaseless))
{
uindex_t t_last_slash;

if (!MCStringLastIndexOfChar(MCcmd, '/', UINDEX_MAX, kMCStringOptionCompareExact, t_last_slash))
t_last_slash = MCStringGetLength(MCcmd);

return MCStringCopySubstring(MCcmd, MCRangeMake(0, t_last_slash), r_folder) ? True : False;
MCSAutoLibraryRef t_self;
MCSLibraryCreateWithAddress(reinterpret_cast<void *>(legacy_path_to_nt_path),
&t_self);
MCSLibraryCopyNativePath(*t_self,
&t_native_path);

t_wasfound = True;
}
else
{
Expand Down
7 changes: 7 additions & 0 deletions libfoundation/include/system-library.h
Expand Up @@ -81,6 +81,13 @@ MCSLibraryCreateWithAddress(void *p_address,
* static type, this returns the path of the loadable object which the library
* is linked into. */
MC_DLLEXPORT bool
MCSLibraryCopyNativePath(MCSLibraryRef p_library,
MCStringRef& r_path);

/* Copy the full (non-native) path to the specified library. If the library is of
* static type, this returns the path of the loadable object which the library
* is linked into. */
MC_DLLEXPORT bool
MCSLibraryCopyPath(MCSLibraryRef p_library,
MCStringRef& r_path);

Expand Down
7 changes: 7 additions & 0 deletions libfoundation/src/system-library.cpp
Expand Up @@ -290,6 +290,13 @@ MCSLibraryCreateWithAddress(void *p_address,
return true;
}

MC_DLLEXPORT_DEF bool
MCSLibraryCopyNativePath(MCSLibraryRef p_library,
MCStringRef& r_path)
{
return __MCSLibraryGetImpl(p_library).CopyNativePath(r_path);
}

MC_DLLEXPORT_DEF bool
MCSLibraryCopyPath(MCSLibraryRef p_library,
MCStringRef& r_path)
Expand Down

0 comments on commit 53f641c

Please sign in to comment.