7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 10:00:13 +00:00

Handle home dir shortcut in jobset destinations.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20032
This commit is contained in:
Jeff Young 2025-03-20 10:44:45 +00:00
parent 33a8cd942f
commit b366204824
2 changed files with 8 additions and 16 deletions

View File

@ -35,9 +35,7 @@ JOBS_OUTPUT_ARCHIVE::JOBS_OUTPUT_ARCHIVE() :
bool JOBS_OUTPUT_ARCHIVE::OutputPrecheck()
{
if( m_outputPath.IsEmpty() )
{
return false;
}
return true;
}
@ -51,6 +49,9 @@ bool JOBS_OUTPUT_ARCHIVE::HandleOutputs( const wxString& baseTempPath, PROJECT*
wxString outputPath = ExpandTextVars( m_outputPath, aProject );
outputPath = ExpandEnvVarSubstitutions( outputPath, aProject );
if( outputPath.StartsWith( "~" ) )
outputPath.Replace( "~", wxGetHomeDir(), false );
wxFFileOutputStream ostream( outputPath );
if( !ostream.IsOk() ) // issue to create the file. Perhaps not writable dir
@ -64,14 +65,10 @@ bool JOBS_OUTPUT_ARCHIVE::HandleOutputs( const wxString& baseTempPath, PROJECT*
wxString errors;
if( !AddDirectoryToZip( zipstream, baseTempPath, errors ) )
{
success = false;
}
if( !zipstream.Close() )
{
success = false;
}
return success;
}

View File

@ -36,33 +36,28 @@ bool JOBS_OUTPUT_FOLDER::HandleOutputs( const wxString& baseTempPath, PROJECT* a
wxString outputPath = ExpandTextVars( m_outputPath, aProject );
outputPath = ExpandEnvVarSubstitutions( outputPath, aProject );
if( outputPath.StartsWith( "~" ) )
outputPath.Replace( "~", wxGetHomeDir(), false );
if( !wxFileName::DirExists( outputPath ) )
{
if( !wxFileName::Mkdir( outputPath, wxS_DIR_DEFAULT ) )
{
return false;
}
}
bool success = true;
wxString errors;
if( !CopyDirectory( baseTempPath, outputPath, errors ) )
{
success = false;
}
return false;
return success;
return true;
}
bool JOBS_OUTPUT_FOLDER::OutputPrecheck()
{
if( m_outputPath.IsEmpty() )
{
return false;
}
return true;
}