Skip to content

Commit

Permalink
use platformPath in import_chugin_opt()
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed Nov 2, 2024
1 parent bb598d6 commit 1ce5514
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/core/chuck_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1520,28 +1520,28 @@ static void logChuginLoad( const string & name, t_CKINT logLevel )
// name: import_chugin_opt()
// desc: load chugin module by path, with options
//-----------------------------------------------------------------------------
t_CKBOOL Chuck_Compiler::import_chugin_opt( const string & thePath, const string & name, string & errorStr )
t_CKBOOL Chuck_Compiler::import_chugin_opt( const string & path, const string & name, string & errorStr )
{
// get env
Chuck_Env * env = this->env();
// platform-specific path (below: will use the appropriate '/' vs '\\')
string path = thePath;
string platformPath = path;

// NOTE this (verbose >= 5) is more informative if the chugin crashes, we can see the name
EM_log( CK_LOG_INFO, "@import loading [chugin] %s...", name.c_str() );

// create chuck DLL data structure
Chuck_DLL * dll = new Chuck_DLL( this->carrier(), name != "" ? name.c_str() : (extract_filepath_file(thePath)).c_str() );
Chuck_DLL * dll = new Chuck_DLL( this->carrier(), name != "" ? name.c_str() : (extract_filepath_file(path)).c_str() );
t_CKBOOL query_failed = FALSE;

// clear error string
errorStr = "";

#if defined(__PLATFORM_WINDOWS__)
// replace '/' with '\\'
std::replace( path.begin(), path.end(), '/', '\\' );
std::replace( platformPath.begin(), platformPath.end(), '/', '\\' );
// the dll search path to add
string dll_path = extract_filepath_dir( path );
string dll_path = extract_filepath_dir( platformPath );
// the relateive _deps directory
string dll_deps_path = dll_path + "_deps\\";
// convert to wchar
Expand All @@ -1554,7 +1554,7 @@ t_CKBOOL Chuck_Compiler::import_chugin_opt( const string & thePath, const string
#endif

// load (but don't query yet; lazy mode == TRUE)
if( dll->load( path.c_str(), CK_QUERY_FUNC, TRUE) )
if( dll->load( platformPath.c_str(), CK_QUERY_FUNC, TRUE) )
{
// probe it
dll->probe();
Expand Down

0 comments on commit 1ce5514

Please sign in to comment.