Skip to content

Commit

Permalink
fix extract_filepath_ext()
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed Oct 27, 2024
1 parent 1b7e0a5 commit 86425c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/chuck_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ t_CKBOOL Chuck_Compiler::visit( ImportTargetNode * node,
// this function updates 'filename' with the first match
//-----------------------------------------------------------------------------
static t_CKBOOL matchFilename( std::string & filename,
const std::string & ext,
const std::vector<std::string> & extensions )
const std::string & ext,
const std::vector<std::string> & extensions )
{
// test filename as is
if( ck_fileexists( filename ) && !ck_isdir( filename ) ) return TRUE;
Expand Down
4 changes: 2 additions & 2 deletions src/core/util_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,10 +915,10 @@ std::string extract_filepath_ext( const std::string & filepath )
// look for separator from the right
size_t pathPos = normalize.rfind( path_separator );
// if path separator found after the rightmost ext separator
if( pathPos > extPos ) return "";
if( (pathPos != std::string::npos) && (pathPos > extPos) ) return "";

// substring after the rightmost ext separator
return std::string( filepath, extPos );
return std::string( normalize, extPos );
}


Expand Down

0 comments on commit 86425c2

Please sign in to comment.