Skip to content

Commit

Permalink
fix --chugin-path full path
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed Nov 8, 2024
1 parent ddf27b3 commit 02f5d1d
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/core/chuck_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,8 @@ t_CKBOOL scan_external_modules_in_directory( const string & directory,
{
// expand directory path
string path = expand_filepath( directory, FALSE );
// normalize path
path = normalize_directory_name( path );
// open the directory
DIR * dir = opendir( path.c_str() );

Expand All @@ -1459,15 +1461,15 @@ t_CKBOOL scan_external_modules_in_directory( const string & directory,
if( extension_matches( de->d_name, ".ck" ) )
{
// construct absolute path
string absolute_path = path + "/" + de->d_name;
string absolute_path = path + de->d_name;
// append file path
ckfiles2load.push_back( absolute_path );
}
// check extension passed in
else if( extension_matches( de->d_name, extension ) )
{
// construct absolute path
string absolute_path = path + "/" + de->d_name;
string absolute_path = path + de->d_name;
// append module
chugins2load.push_back( ChuginFileInfo( de->d_name, absolute_path ) );
}
Expand All @@ -1481,7 +1483,7 @@ t_CKBOOL scan_external_modules_in_directory( const string & directory,
strncmp( de->d_name, "..", sizeof( ".." ) ) != 0 )
{
// construct absolute path (use the non-expanded path for consistency when printing)
string absolute_path = string(directory) + "/" + de->d_name;
string absolute_path = string(directory) + de->d_name;
// queue search in sub-directory
dirs2search.push_back( absolute_path );
}
Expand Down Expand Up @@ -1832,7 +1834,7 @@ t_CKBOOL Chuck_Compiler::load_external_modules( const string & extension,
std::string error_str;
// expand the filepath (e.g., ~) | 1.5.2.6 (ge) added
dl_path = expand_filepath( dl_path );
// make full path
// get full path | 1.5.4.2 (ge) added
dl_path = get_full_path( dl_path );
// check extension, append if no match
if( !extension_matches( dl_path, extension ) )
Expand All @@ -1841,14 +1843,16 @@ t_CKBOOL Chuck_Compiler::load_external_modules( const string & extension,
this->importChugin( dl_path, FALSE, mini(dl_path.c_str()), error_str );
}

// now recurse through search paths and load any DLs or .ck files found
// now recurse through search paths and load any .chug files found
for( list<string>::iterator i_sp = chugin_search_paths.begin();
i_sp != chugin_search_paths.end(); i_sp++ )
{
// expand the filepath (e.g., ~) | 1.5.2.6 (ge) added
string dl_path = expand_filepath(*i_sp);
string dl_path = expand_filepath( *i_sp );
// get full path | 1.5.4.2 (ge) added
dl_path = get_full_path( dl_path );
// search directory and load contents
load_external_modules_in_directory( *i_sp, extension, recursiveSearch );
load_external_modules_in_directory( dl_path, extension, recursiveSearch );
}

// clear context
Expand Down Expand Up @@ -2052,7 +2056,7 @@ t_CKBOOL Chuck_Compiler::probe_external_modules( const string & extension,
std::string & dl_path = *i_dl;
// expand the filepath (e.g., ~) | 1.5.2.6 (ge) added
dl_path = expand_filepath( dl_path );
// get full path
// get full path | 1.5.4.2 (ge) added
dl_path = get_full_path( dl_path );
// check extension, append if no match
if( !extension_matches( dl_path, extension ) )
Expand All @@ -2072,12 +2076,14 @@ t_CKBOOL Chuck_Compiler::probe_external_modules( const string & extension,
// push
EM_pushlog();

// now recurse through search paths and note any DLs or .ck files found
// now recurse through search paths and note any .chug files found
for( list<string>::iterator i_sp = chugin_search_paths.begin();
i_sp != chugin_search_paths.end(); i_sp++ )
{
// expand the filepath (e.g., ~) | 1.5.2.6 (ge) added
string dl_path = expand_filepath(*i_sp);
string dl_path = expand_filepath( *i_sp );
// get full path | 1.5.4.2 (ge) added
dl_path = get_full_path( dl_path );
// search directory and load contents
probe_external_modules_in_directory( dl_path, extension, recursiveSearch, ck_libs );
}
Expand Down

0 comments on commit 02f5d1d

Please sign in to comment.