75 if( rawInputs.empty() )
77 wxFprintf( stderr,
_(
"At least one input file is required\n" ) );
81 std::vector<wxString> inputFiles;
83 for(
const std::string& raw : rawInputs )
84 inputFiles.push_back(
From_UTF8( raw.c_str() ) );
86 std::map<wxString, wxString> layerMap;
89 if( !layerMapFile.IsEmpty() )
95 wxFprintf( stderr, wxS(
"%s\n" ), error );
100 wxFileName projectFn;
102 if( !outputArg.IsEmpty() )
104 projectFn.Assign( outputArg );
108 wxFileName firstInput( inputFiles.front() );
109 projectFn.AssignDir( wxFileName::GetCwd() );
110 projectFn.SetName( firstInput.GetName() );
114 projectFn.MakeAbsolute();
116 if( !projectFn.DirExists()
117 && !wxFileName::Mkdir( projectFn.GetPath(), wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
119 wxFprintf( stderr,
_(
"Could not create output directory: %s\n" ), projectFn.GetPath() );
123 wxString stem = projectFn.GetName();
124 wxString dir = projectFn.GetPath();
139 wxFprintf( stderr,
_(
"Could not create project: %s\n" ), projectFn.GetFullPath() );
144 bool haveBoard =
false;
145 bool haveSch =
false;
148 for(
const wxString& input : inputFiles )
156 std::unique_ptr<JOB_PCB_IMPORT> pcbJob = std::make_unique<JOB_PCB_IMPORT>();
157 pcbJob->m_inputFile = input;
159 pcbJob->m_layerMap = layerMap;
160 pcbJob->SetConfiguredOutputPath( boardFn.GetFullPath() );
178 std::unique_ptr<JOB_SCH_IMPORT> schJob = std::make_unique<JOB_SCH_IMPORT>();
179 schJob->m_inputFile = input;
181 schJob->SetConfiguredOutputPath( schFn.GetFullPath() );
197 if( haveBoard && haveSch )
199 wxFprintf( stderr,
_(
"Could not import '%s': a board and a schematic have already "
200 "been imported for this project\n" ), input );
204 wxFprintf( stderr,
_(
"No board or schematic importer recognizes the file: %s\n" ),
214 wxFprintf( stderr,
_(
"No inputs could be imported\n" ) );
223 std::vector<FILE_INFO_PAIR>&
boards =
project->GetProjectFile().GetBoards();
225 boards.emplace_back( std::make_pair(
KIID(), boardFn.GetFullName() ) );
230 reporter.Report( wxString::Format(
_(
"Created project '%s'\n" ),
231 projectFn.GetFullPath() ),
236 wxFprintf( stderr,
_(
"Failed to write project file: %s\n" ),
237 projectFn.GetFullPath() );
bool LoadLayerMapFile(const wxString &aFile, std::map< wxString, wxString > &aMap, wxString &aError)
Load an explicit layer-mapping file into aMap.