void ExpanderWindow::StartExpanding() { ExpanderRule* rule = fRules.MatchingRule(&fSourceRef); if (!rule) return; BEntry destEntry(fDestText->Text(), true); if (!destEntry.Exists()) { BAlert* alert = new BAlert("destAlert", B_TRANSLATE("The folder was either moved, renamed or not\nsupported."), B_TRANSLATE("Cancel"), NULL, NULL, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT); alert->Go(); return; } BMessage message; message.AddString("cmd", rule->ExpandCmd()); message.AddRef("srcRef", &fSourceRef); message.AddRef("destRef", &fDestRef); fExpandButton->SetLabel(B_TRANSLATE("Stop")); fSourceButton->SetEnabled(false); fDestButton->SetEnabled(false); fShowContents->SetEnabled(false); fSourceItem->SetEnabled(false); fDestItem->SetEnabled(false); fExpandItem->SetEnabled(false); fShowItem->SetEnabled(false); fStopItem->SetEnabled(true); fPreferencesItem->SetEnabled(false); BEntry entry(&fSourceRef); BPath path(&entry); BString text(B_TRANSLATE("Expanding '%s'")); text.ReplaceFirst("%s", path.Leaf()); fStatusView->SetText(text.String()); fExpandingThread = new ExpanderThread(&message, new BMessenger(this)); fExpandingThread->Start(); fExpandingStarted = true; }
index_mapping_t CPathDictionary::Merge (const CPathDictionary& source) { index_mapping_t result; result.insert (0, 0); result.insert ((index_t)NO_INDEX, (index_t)NO_INDEX); index_mapping_t elementMapping = pathElements.Merge (source.pathElements); for (index_t i = 1, count = source.size(); i < count; ++i) { const std::pair<index_t, index_t>& sourcePath = source.paths[i]; std::pair<index_t, index_t> destEntry ( *result.find (sourcePath.first) , *elementMapping.find (sourcePath.second)); result.insert (i, paths.AutoInsert (destEntry)); } return result; }
void ProjectWindow::ImportFile(entry_ref ref) { BString command; DPath srcpath(ref); DPath destpath(fProject->GetPath().GetFolder()); command << "copyattr --data '" << srcpath.GetFullPath() << "' '" << destpath.GetFullPath() << "'"; system(command.String()); BString ext(srcpath.GetExtension()); if ((ext.ICompare("h") == 0) || (ext.ICompare("hxx") == 0) || (ext.ICompare("hpp") == 0) || (ext.ICompare("h++") == 0)) return; DPath destfile(destpath); destfile << ref.name; BEntry destEntry(destfile.GetFullPath()); entry_ref destref; destEntry.GetRef(&destref); AddFile(destref,NULL); }