MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / autoSetProjectDirectory

Method autoSetProjectDirectory

Engine/ProjectPrivate.cpp:303–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303void
304ProjectPrivate::autoSetProjectDirectory(const QString& path)
305{
306 std::string pathCpy = path.toStdString();
307
308 if ( !pathCpy.empty() && (pathCpy[pathCpy.size() - 1] == '/') ) {
309 pathCpy.erase(pathCpy.size() - 1, 1);
310 }
311 std::string env;
312 try {
313 env = envVars->getValue();
314 } catch (...) {
315 // ignore
316 }
317
318 std::list<std::vector<std::string> > table;
319 envVars->decodeFromKnobTableFormat(env, &table);
320
321 ///If there was already a OCIO variable, update it, otherwise create it
322 bool foundProject = false;
323 for (std::list<std::vector<std::string> >::iterator it = table.begin(); it != table.end(); ++it) {
324 if ( (*it)[0] == NATRON_PROJECT_ENV_VAR_NAME ) {
325 (*it)[1] = pathCpy;
326 foundProject = true;
327 break;
328 }
329 }
330 if (!foundProject) {
331 std::vector<std::string> vec(2);
332 vec[0] = NATRON_PROJECT_ENV_VAR_NAME;
333 vec[1] = pathCpy;
334 table.push_back(vec);
335 }
336
337
338 std::string newEnv = envVars->encodeToKnobTableFormat(table);
339 if (env != newEnv) {
340 if ( appPTR->getCurrentSettings()->isAutoFixRelativeFilePathEnabled() ) {
341 _publicInterface->fixRelativeFilePaths(NATRON_PROJECT_ENV_VAR_NAME, pathCpy, false);
342 }
343 envVars->setValue(newEnv);
344 }
345}
346
347std::string
348ProjectPrivate::runOnProjectSaveCallback(const std::string& filename,

Callers 1

saveProjectInternalMethod · 0.80

Calls 14

toStdStringMethod · 0.80
emptyMethod · 0.80
getCurrentSettingsMethod · 0.80
fixRelativeFilePathsMethod · 0.80
sizeMethod · 0.45
eraseMethod · 0.45
getValueMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected