Skip to content

Commit

Permalink
fix import search path resolution; fix windows default system paths
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed Nov 8, 2024
1 parent 02f5d1d commit 6d85bc3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/core/chuck_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1850,7 +1850,7 @@ t_CKBOOL Chuck_Compiler::load_external_modules( const string & extension,
// expand the filepath (e.g., ~) | 1.5.2.6 (ge) added
string dl_path = expand_filepath( *i_sp );
// get full path | 1.5.4.2 (ge) added
dl_path = get_full_path( dl_path );
dl_path = get_full_path( dl_path, TRUE );
// search directory and load contents
load_external_modules_in_directory( dl_path, extension, recursiveSearch );
}
Expand Down Expand Up @@ -2083,7 +2083,7 @@ t_CKBOOL Chuck_Compiler::probe_external_modules( const string & extension,
// expand the filepath (e.g., ~) | 1.5.2.6 (ge) added
string dl_path = expand_filepath( *i_sp );
// get full path | 1.5.4.2 (ge) added
dl_path = get_full_path( dl_path );
dl_path = get_full_path( dl_path, TRUE );
// search directory and load contents
probe_external_modules_in_directory( dl_path, extension, recursiveSearch, ck_libs );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/chuck_dl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ char g_default_path_system[] = "/usr/local/lib/chuck:/Library/Application Suppor
char g_default_path_packages[] = "~/.chuck/packages";
char g_default_path_user[] = "~/Library/Application Support/ChucK/chugins:~/.chuck/lib";
#elif defined(__PLATFORM_WINDOWS__)
char g_default_path_system[] = "C:\\Windows\\system32\\ChucK;C:\\Program Files\\ChucK\\chugins;C:\\Program Files (x86)\\ChucK\\chugins;";
char g_default_path_system[] = "C:\\Windows\\system32\\ChucK;C:\\Program Files\\ChucK\\chugins;C:\\Program Files (x86)\\ChucK\\chugins";
char g_default_path_packages[] = "C:\\Users\\%USERNAME%\\Documents\\ChucK\\packages";
char g_default_path_user[] = "C:\\Users\\%USERNAME%\\Documents\\ChucK\\chugins";
#else // Linux / Cygwin
Expand Down
6 changes: 3 additions & 3 deletions src/core/util_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,9 +761,9 @@ std::string expandFilePathWindows( const string & path )

//-----------------------------------------------------------------------------
// name: get_full_path()
// desc: get full path to file
// desc: get full path to file; if treatAsDir is TRUE, then don't auto-match .ck
//-----------------------------------------------------------------------------
std::string get_full_path( const std::string & fp )
std::string get_full_path( const std::string & fp, t_CKBOOL treatAsDir )
{
#ifndef __PLATFORM_WINDOWS__

Expand Down Expand Up @@ -797,7 +797,7 @@ std::string get_full_path( const std::string & fp )
}

// try with .ck extension
if( result == 0 && !extension_matches(fp, ".ck") )
if( result == 0 && !treatAsDir && !extension_matches(fp, ".ck") )
{
#ifndef __CHUNREAL_ENGINE__
result = GetFullPathName((fp + ".ck").c_str(), MAX_PATH, buf, NULL);
Expand Down
2 changes: 1 addition & 1 deletion src/core/util_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ t_CKBOOL extract_args( const std::string & token,
std::string dir_go_up( const std::string & dir, t_CKINT numUp );

// get full path to file
std::string get_full_path( const std::string & fp );
std::string get_full_path( const std::string & fp, t_CKBOOL treatAsDirector = FALSE );

// perform filepath expansion (e.g., with ~ on unix systems and some windows)
std::string expand_filepath( const std::string & fp, t_CKBOOL ensurePathExists = FALSE );
Expand Down

0 comments on commit 6d85bc3

Please sign in to comment.