void SceneSync::EndClientSync(bool abort) { if (fTimerID != 0 || fUpdateSignal) { KillTimer(NULL, fTimerID); fTimerID = 0; if (!abort) { SaveResMgr(); IShutdownClient(); } else { // Delete files so we won't try to run with this possibly corrupted data char path[MAX_PATH]; if (GetOutputDir(path)) IDeletePath(path); } delete fUpdateSignal; fUpdateSignal = nil; hsAssert( false, "YOU NEED TO FIX ME" ); // hsgResMgr::ResMgr()->PageOutConverted(); // hsgResMgr::Reset(); } }
void WorkspaceWork::AddFile(ADDFILE af) { String active = GetActivePackage(); if(active.IsEmpty()) return; FileSel *fs = &OutputFs(); RealizeDirectory(GetLocalDir()); switch(af) { case PACKAGE_FILE: fs = &BasedSourceFs(); fs->BaseDir(GetFileFolder(PackagePathA(active))); break; case ANY_FILE: fs = &AnySourceFs(); break; case OUTPUT_FILE: fs->ActiveDir(GetOutputDir()); break; case CONFIG_FILE: fs->ActiveDir(GetConfigDir()); break; case HOME_FILE: fs->ActiveDir(GetHomeDirectory()); break; case LOCAL_FILE: fs->ActiveDir(GetLocalDir()); break; default: ; // GCC warns otherwise } if(!fs->ExecuteOpen("Add files to package..")) return; int fci = filelist.GetCursor(); int cs = filelist.GetSbPos(); int ci = fci >= 0 && fci < fileindex.GetCount() ? fileindex[fci] : -1; for(int i = 0; i < fs->GetCount(); i++) { Package::File& f = ci >= 0 ? actual.file.Insert(ci++) : actual.file.Add(); f = (*fs)[i]; f.readonly = fs->GetReadOnly(); } SaveLoadPackage(false); filelist.SetSbPos(cs); filelist.SetCursor(fci >= 0 ? fci : filelist.GetCount() - 1); FileSelected(); }
bool SceneSync::BeginClientSync(const char *semaphoreName, const char *pipeName) { char path[MAX_PATH]; if (!GetOutputDir(path)) return false; char datPath[MAX_PATH]; sprintf(datPath, "%sdat", path); // Load the saved rooms and their keys (but not objects) hsAssert( false, "YOU NEED TO FIX ME" ); // hsgResMgr::ResMgr()->ForceLoadDirectory(datPath, true/*false*/); // TEMP // Set the keys in the plMaxNodes. Also, delete Plasma objects for any // plMaxNodes that can't be found (must have been deleted). IReadNodeMap(path); if (!fSceneWatcher) IStartWatching(true); if (fUpdateFreq != -1) fTimerID = SetTimer(NULL, 0, fUpdateFreq, ITimerProc); // Update(); fUpdateSignal = new hsSemaphore(0, semaphoreName); fPipeName = pipeName; return true; }
bool SceneSync::SaveResMgr() { // Get the output directory for the current file char path[MAX_PATH]; if (!GetOutputDir(path)) return false; IWriteNodeMap(path); return true; }
bool SceneSync::CreateClientData() { char path[MAX_PATH]; if (!GetOutputDir(path)) return false; char datPath[MAX_PATH]; sprintf(datPath, "%sdat", path); // Setup for the convert plExportErrorMsg msg; plConvertSettings settings; settings.fSceneViewer = true; plConvert::Instance().Init(GetCOREInterface(), &msg, &settings); // Do the convert plConvert::Instance().Convert(); // If convert failed, fail too if (msg.IsBogus()) return false; // Clear the dirty flags since everything is fresh IClearDirtyRecur((plMaxNode*)GetCOREInterface()->GetRootNode()); // // Write the converted data out and page out the objects // IDeletePath(path); CreateDirectory(path, NULL); CreateDirectory(datPath, NULL); // TEMP char oldCWD[MAX_PATH]; getcwd(oldCWD, MAX_PATH); chdir(path); hsAssert( false, "YOU NEED TO FIX ME" ); // hsgResMgr::ResMgr()->Write(); // TEMP chdir(oldCWD); IWriteNodeMap(path); // TEMP hsMaterialConverter::Instance().FreeMaterialCache(path); hsAssert( false, "YOU NEED TO FIX ME" ); // hsgResMgr::ResMgr()->PageOutConverted(); hsgResMgr::Reset(); return true; }
bool SceneSync::CanLoadOldResMgr() { char path[MAX_PATH]; if (!GetOutputDir(path)) return false; strcat(path, kKeysFile); hsUNIXStream s; if (s.Open(path)) { s.Close(); return true; } return false; }
void WorkspaceWork::InsertSpecialMenu(Bar& menu) { bool isaux = IsAux(); menu.Add("Insert any file(s)", THISBACK1(AddFile, ANY_FILE)) .Key(K_SHIFT|K_CTRL_I) .Help("Insert files from anywhere on disk (discouraged in portable packages)"); menu.Add(isaux && GetOutputDir().GetCount(), "Insert output directory file(s)", THISBACK1(AddFile, OUTPUT_FILE)) .Help("Open file selector in output / intermediate directory for current package"); #ifdef PLATFORM_POSIX menu.Add(isaux && GetConfigDir().GetCount(), "Insert config directory file(s)", THISBACK1(AddFile, CONFIG_FILE)) .Help("Open file selector in output / intermediate directory for current package"); #endif menu.Add(isaux, "Insert Local directory file(s)", THISBACK1(AddFile, LOCAL_FILE)) .Help("Open file selector in Local directory for current package"); menu.Add("Insert home directory file(s)", THISBACK1(AddFile, HOME_FILE)) .Help("Open file selector in current user's HOME directory"); }
static FileOutputStream *InitialiseIO (const HashTable * const config_p, const char * const key_s, const char * const suffix_s) { FileOutputStream *stream_p = NULL; const char * const output_dir_s = GetOutputDir (); /* Make sure that the output directory exists */ if (EnsureDirectoryExists (output_dir_s)) { char *output_filename_s = (char *) GetFromHashTable (config_p, "OutputFilename"); /* Adapt the streams to be relative to our output directory */ char *name_s = GetStreamName (output_dir_s, output_filename_s, (char *) GetFromHashTable (config_p, key_s), suffix_s); stream_p = AllocateFileOutputStream (name_s); if (name_s) { FreeCopiedString (name_s); } } /* if (CreateNewDirectory (output_dir_s)) */ return stream_p; }