Emmanuel BENOîT
68d01ca42e
Shaders are no longer found under /shaders in the project; they can be anywhere. In addition, paths for both (program) instructions in the script and include directives in shader source code are relative to the file which contains them.
62 lines
1.3 KiB
C++
62 lines
1.3 KiB
C++
#include "externals.hh"
|
|
#include "c-project.hh"
|
|
|
|
|
|
/*= A_ProjectPathListener ====================================================*/
|
|
|
|
A_ProjectPathListener::~A_ProjectPathListener( ) {}
|
|
|
|
|
|
/*= T_Project ================================================================*/
|
|
|
|
void T_Project::setBasePath(
|
|
T_FSPath const& path ) noexcept
|
|
{
|
|
assert( path.isValid( ) );
|
|
if ( basePath_ == path ) {
|
|
return;
|
|
}
|
|
|
|
if ( path.isRelative( ) ) {
|
|
basePath_ = ( Filesystem::Cwd( ) + path ).canonical( );
|
|
} else {
|
|
basePath_ = path.canonical( );
|
|
}
|
|
|
|
const auto n{ listeners_.size( ) };
|
|
for ( auto i = 0u ; i < n ; i ++ ) {
|
|
listeners_[ i ]->projectPathChanged( );
|
|
}
|
|
}
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
T_FSPath T_Project::pathOf(
|
|
T_FSPath const& file ) const noexcept
|
|
{
|
|
if ( file.isAbsolute( ) ) {
|
|
if ( file.canonical( ).isUnder( basePath_ ) ) {
|
|
return file;
|
|
}
|
|
return basePath_;
|
|
}
|
|
return ( basePath_ + file ).canonical( );
|
|
}
|
|
|
|
T_FSPath T_Project::pathOf(
|
|
char const* file ) const noexcept
|
|
{
|
|
return pathOf( T_String{ file } );
|
|
}
|
|
|
|
T_String T_Project::strPathOf(
|
|
T_FSPath const& file ) const noexcept
|
|
{
|
|
return pathOf( file ).toString( );
|
|
}
|
|
|
|
T_String T_Project::strPathOf(
|
|
char const* file ) const noexcept
|
|
{
|
|
return strPathOf( T_String{ file } );
|
|
}
|