本文整理汇总了C++中wxFileName类的典型用法代码示例。如果您正苦于以下问题:C++ wxFileName类的具体用法?C++ wxFileName怎么用?C++ wxFileName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxFileName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: FromAbsoluteWx
FilePath FilePath::FromAbsoluteWx(const wxFileName& wxFn){
assert(wxFn.IsAbsolute());
assert(!wxFn.IsDir());
return FilePath(new PathImpl(wxFn));
}
开发者ID:lukas-ke,项目名称:faint-graphics-editor,代码行数:5,代码来源:file-path.cpp
示例2: AddWorkspaceToRecentlyUsedList
void PluginManager::AddWorkspaceToRecentlyUsedList(const wxFileName& filename)
{
if(filename.Exists()) {
ManagerST::Get()->AddToRecentlyOpenedWorkspaces(filename.GetFullPath());
}
}
开发者ID:lpc1996,项目名称:codelite,代码行数:6,代码来源:pluginmanager.cpp
示例3: wxMessageBox
bool
header_editor_frame_c::open_file(wxFileName file_name) {
if (!kax_analyzer_c::probe(wxMB(file_name.GetFullPath()))) {
wxMessageBox(Z("The file you tried to open is not a Matroska file."), Z("Wrong file selected"), wxOK | wxCENTER | wxICON_ERROR);
return false;
}
m_e_segment_info.reset();
m_e_tracks.reset();
m_analyzer = wx_kax_analyzer_cptr(new wx_kax_analyzer_c(this, wxMB(file_name.GetFullPath())));
if (!m_analyzer->process(kax_analyzer_c::parse_mode_fast)) {
wxMessageBox(Z("This file could not be opened or parsed."), Z("File parsing failed"), wxOK | wxCENTER | wxICON_ERROR);
m_analyzer.reset();
return false;
}
m_file_name = file_name;
m_file_name.GetTimes(nullptr, &m_file_mtime, nullptr);
set_window_title();
m_ignore_tree_selection_changes = true;
enable_menu_entries();
m_bs_main->Hide(m_tc_tree);
for (auto &page : m_pages)
if (page->IsShown())
page->Hide();
m_tc_tree->DeleteChildren(m_root_id);
m_bs_page->Clear();
m_pages.clear();
m_top_level_pages.clear();
for (auto &data : m_analyzer->m_data)
if (data->m_id == KaxInfo::ClassInfos.GlobalId) {
handle_segment_info(data.get());
break;
}
for (auto &data : m_analyzer->m_data)
if (data->m_id == KaxTracks::ClassInfos.GlobalId) {
handle_tracks(data.get());
break;
}
m_analyzer->close_file();
m_bs_main->Show(m_tc_tree);
m_bs_main->Layout();
last_open_dir = file_name.GetPath();
m_ignore_tree_selection_changes = false;
return true;
}
开发者ID:CheesyWiggles,项目名称:mkvtoolnix,代码行数:62,代码来源:frame.cpp
示例4: RemoveTraverser
bool wxFileSystemWatcherBase::RemoveTree(const wxFileName& path)
{
if (!path.DirExists())
return false;
// OPT could be optimised if we stored information about relationships
// between paths
class RemoveTraverser : public wxDirTraverser
{
public:
RemoveTraverser(wxFileSystemWatcherBase* watcher,
const wxString& filespec) :
m_watcher(watcher), m_filespec(filespec)
{
}
virtual wxDirTraverseResult OnFile(const wxString& WXUNUSED(filename))
{
// We never watch the individual files when watching the tree, so
// nothing to do here.
return wxDIR_CONTINUE;
}
virtual wxDirTraverseResult OnDir(const wxString& dirname)
{
m_watcher->Remove(wxFileName::DirName(dirname));
return wxDIR_CONTINUE;
}
private:
wxFileSystemWatcherBase* m_watcher;
wxString m_filespec;
};
// If AddTree() used a filespec, we must use the same one
wxString canonical = GetCanonicalPath(path);
wxFSWatchInfoMap::iterator it = m_watches.find(canonical);
wxCHECK_MSG( it != m_watches.end(), false,
wxString::Format("Path '%s' is not watched", canonical) );
wxFSWatchInfo watch = it->second;
const wxString filespec = watch.GetFilespec();
#if defined(__WINDOWS__)
// When there's no filespec, the wxMSW AddTree() would have set a watch
// on only the passed 'path'. We must therefore remove only this
if (filespec.empty())
{
return Remove(path);
}
// Otherwise fall through to the generic implementation
#endif // __WINDOWS__
wxDir dir(path.GetFullPath());
// AddTree() might have used the wxDIR_NO_FOLLOW to prevent asserts or
// infinite loops in trees containing symlinks. We need to do the same
// or we'll try to remove unwatched items. Let's hope the caller used
// the same ShouldFollowLink() setting as in AddTree()...
int flags = wxDIR_DIRS;
if ( !path.ShouldFollowLink() )
{
flags |= wxDIR_NO_FOLLOW;
}
RemoveTraverser traverser(this, filespec);
dir.Traverse(traverser, filespec, flags);
// As in AddTree() above, handle the path itself explicitly.
Remove(path);
return true;
}
开发者ID:lpoujoulat,项目名称:wxWidgetsToolPalette,代码行数:70,代码来源:fswatchercmn.cpp
示例5: DoLoadFile
/** DoLoadFile
*
* Handles loading an assembly file into the simulator
*/
void ComplxFrame::DoLoadFile(const wxFileName& filename)
{
//CleanUp();
lc3_state dummy_state;
lc3_init(dummy_state);
// Save the symbols
std::map<std::string, unsigned short> symbol_table = state.symbols;
std::map<unsigned short, std::string> rev_symbol_table = state.rev_symbols;
state.symbols.clear();
state.rev_symbols.clear();
lc3_remove_plugins(state);
try
{
std::vector<code_range> ranges;
lc3_assemble(dummy_state, filename.GetFullPath().ToStdString(), false);
lc3_assemble(state, filename.GetFullPath().ToStdString(), ranges);
modified_addresses.clear();
for (const auto& code_range : ranges)
modified_addresses.push_back(ViewRange(code_range.location, code_range.location + code_range.size));
// Dummy call to update hidden addresses.
wxCommandEvent event;
OnUpdateHideAddresses(event);
}
catch (LC3AssembleException e)
{
wxMessageBox(wxString::Format("BAD STUDENT! %s", e.what()), _("Loading ") + filename.GetFullName() + _(" Failed"));
goto merge;
}
catch (std::vector<LC3AssembleException> e)
{
std::stringstream oss;
for (unsigned int i = 0; i < e.size(); i++)
oss << e[i].what() << std::endl;
wxMessageBox(wxString::Format("BAD STUDENT! %s", oss.str()), _("Loading ") + filename.GetFullName() + _(" Failed"));
goto merge;
}
//if (DoAssemble(filename)) return;
currentFile = filename;
SetTitle(wxString::Format("Complx - %s", filename.GetFullPath()));
merge:
std::map<std::string, unsigned short>::const_iterator i;
std::map<unsigned short, std::string>::const_iterator j;
for (i = symbol_table.begin(); i != symbol_table.end(); ++i)
{
state.symbols[i->first] = i->second;
}
for (j = rev_symbol_table.begin(); j != rev_symbol_table.end(); ++j)
{
state.rev_symbols[j->first] = j->second;
}
//DoLoad(filename);
UpdateStatus();
UpdateRegisters();
UpdateMemory();
}
开发者ID:BenTheElder,项目名称:complx,代码行数:66,代码来源:ComplxFrame.cpp
示例6: BuildTree
void SymbolTree::BuildTree(const wxFileName &fileName, TagEntryPtrVector_t* tags /*NULL*/)
{
TagEntryPtrVector_t newTags;
if ( !tags ) {
// Get the current database
ITagsStoragePtr db = TagsManagerST::Get()->GetDatabase();
if ( ! db ) {
Clear();
return;
}
// Load the new tags from the database
db->SelectTagsByFile(fileName.GetFullPath(), newTags);
// Compare the new tags with the old ones
if ( TagsManagerST::Get()->AreTheSame(newTags, m_currentTags) )
return;
m_currentTags.clear();
m_currentTags.insert(m_currentTags.end(), newTags.begin(), newTags.end());
} else {
m_currentTags.clear();
m_currentTags.insert(m_currentTags.end(), tags->begin(), tags->end());
}
wxWindowUpdateLocker locker(this);
Clear();
m_fileName = fileName;
// Convert them into tree
m_tree = TagsManagerST::Get()->Load(m_fileName, &m_currentTags);
if ( !m_tree ) {
return;
}
// Add invisible root node
wxTreeItemId root;
root = AddRoot(fileName.GetFullName(), 15, 15);
TreeWalker<wxString, TagEntry> walker(m_tree->GetRoot());
// add three items here:
// the globals node, the mcros and the prototype node
m_globalsNode = AppendItem(root, wxT("Global Functions and Variables"), 2, 2, new MyTreeItemData(wxT("Global Functions and Variables"), wxEmptyString));
m_prototypesNode = AppendItem(root, wxT("Functions Prototypes"), 2, 2, new MyTreeItemData(wxT("Functions Prototypes"), wxEmptyString));
m_macrosNode = AppendItem(root, wxT("Macros"), 2, 2, new MyTreeItemData(wxT("Macros"), wxEmptyString));
// Iterate over the tree and add items
m_sortItems.clear();
Freeze();
for (; !walker.End(); walker++) {
// Add the item to the tree
TagNode* node = walker.GetNode();
// Skip root node
if (node->IsRoot())
continue;
// Add the node
AddItem(node);
}
SortTree(m_sortItems);
if ( ItemHasChildren(m_globalsNode) == false ) {
Delete(m_globalsNode);
}
if ( ItemHasChildren(m_prototypesNode) == false ) {
Delete(m_prototypesNode);
}
if ( ItemHasChildren(m_macrosNode) == false ) {
Delete(m_macrosNode);
}
Thaw();
//select the root node by default
if (!(GetWindowStyleFlag() & wxTR_HIDE_ROOT)) {
//root is visible, select it
SelectItem(GetRootItem());
}
}
开发者ID:05storm26,项目名称:codelite,代码行数:83,代码来源:symbol_tree.cpp
示例7: GetBinariesFromRootFolder
wxArrayString FSOExecutable::GetBinariesFromRootFolder(const wxFileName& path, const wxString& globPattern, bool quiet) {
wxArrayString files;
// Check args because this function gets crap tossed at it to validate
wxString pathStr(path.GetPath());
if (pathStr.IsEmpty())
{
wxLogInfo(wxT("GetBinaries called with empty root folder"));
return files;
}
wxDir folder(pathStr);
if (!folder.IsOpened())
{
wxLogInfo(wxT("GetBinaries called on '%s' which cannot be opened"),
pathStr.c_str());
return files;
}
wxString filename;
#if IS_APPLE // Binaries are directories on OSX.
bool cont = folder.GetFirst(&filename, globPattern, wxDIR_DIRS);
#else
bool cont = folder.GetFirst(&filename, globPattern, wxDIR_FILES);
#endif
while (cont) {
#if IS_LINUX
if ( !IsFileToIgnore(filename) ) {
#endif
files.Add(filename);
#if IS_LINUX
}
#endif
cont = folder.GetNext(&filename);
}
// filter out launcher binaries (at least on OSX)
for (int i = files.GetCount() - 1; i >= 0; --i) {
if (files[i].Lower().Find(_T("launcher")) != wxNOT_FOUND) {
files.RemoveAt(i);
}
}
#if IS_APPLE
// find actual (Unix) executable inside .app bundle and call the path to it the "executable"
for (wxArrayString::iterator it = files.begin(), end = files.end(); it != end; ++it) {
wxString pathToBin =
wxDir::FindFirst(path.GetPath(wxPATH_GET_SEPARATOR) + *it + _T("/Contents/MacOS"),
_T("*"),
wxDIR_FILES);
pathToBin.Replace(path.GetPath(wxPATH_GET_SEPARATOR), _T(""));
*it = pathToBin;
}
#endif
if (!quiet) {
wxString execType = globPattern.Lower().Find(_T("fred")) == wxNOT_FOUND ? _T("FS2") : _T("FRED2");
wxLogInfo(_T(" Found %d %s Open executables in '%s'"),
files.GetCount(), execType.c_str(), path.GetPath().c_str());
for (size_t i = 0, n = files.GetCount(); i < n; ++i) {
wxLogDebug(_T("Found executable: %s"), files.Item(i).c_str());
}
}
return files;
}
开发者ID:asarium,项目名称:wxlauncher,代码行数:68,代码来源:FSOExecutable.cpp
示例8: helpDir
// file is a misnomer as it's the name of the base help directory
bool wxExtHelpController::LoadFile(const wxString& file)
{
wxFileName helpDir(wxFileName::DirName(file));
helpDir.MakeAbsolute();
bool dirExists = false;
#if wxUSE_INTL
// If a locale is set, look in file/localename, i.e. If passed
// "/usr/local/myapp/help" and the current wxLocale is set to be "de", then
// look in "/usr/local/myapp/help/de/" first and fall back to
// "/usr/local/myapp/help" if that doesn't exist.
const wxLocale * const loc = wxGetLocale();
if ( loc )
{
wxString locName = loc->GetName();
// the locale is in general of the form xx_YY.zzzz, try the full firm
// first and then also more general ones
wxFileName helpDirLoc(helpDir);
helpDirLoc.AppendDir(locName);
dirExists = helpDirLoc.DirExists();
if ( ! dirExists )
{
// try without encoding
const wxString locNameWithoutEncoding = locName.BeforeLast(_T('.'));
if ( !locNameWithoutEncoding.empty() )
{
helpDirLoc = helpDir;
helpDirLoc.AppendDir(locNameWithoutEncoding);
dirExists = helpDirLoc.DirExists();
}
}
if ( !dirExists )
{
// try without country part
wxString locNameWithoutCountry = locName.BeforeLast(_T('_'));
if ( !locNameWithoutCountry.empty() )
{
helpDirLoc = helpDir;
helpDirLoc.AppendDir(locNameWithoutCountry);
dirExists = helpDirLoc.DirExists();
}
}
if ( dirExists )
helpDir = helpDirLoc;
}
#endif // wxUSE_INTL
if ( ! dirExists && !helpDir.DirExists() )
{
wxLogError(_("Help directory \"%s\" not found."),
helpDir.GetFullPath().c_str());
return false;
}
const wxFileName mapFile(helpDir.GetFullPath(), WXEXTHELP_MAPFILE);
if ( ! mapFile.FileExists() )
{
wxLogError(_("Help file \"%s\" not found."),
mapFile.GetFullPath().c_str());
return false;
}
DeleteList();
m_MapList = new wxList;
m_NumOfEntries = 0;
wxTextFile input;
if ( !input.Open(mapFile.GetFullPath()) )
return false;
for ( wxString& line = input.GetFirstLine();
!input.Eof();
line = input.GetNextLine() )
{
if ( !ParseMapFileLine(line) )
{
wxLogWarning(_("Line %lu of map file \"%s\" has invalid syntax, skipped."),
(unsigned long)input.GetCurrentLine(),
mapFile.GetFullPath().c_str());
}
}
if ( !m_NumOfEntries )
{
wxLogError(_("No valid mappings found in the file \"%s\"."),
mapFile.GetFullPath().c_str());
return false;
}
m_helpDir = helpDir.GetFullPath(); // now it's valid
return true;
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:98,代码来源:helpext.cpp
示例9: IsFilenameSupported
bool BinaryDataGenerator::IsFilenameSupported(const wxFileName &fileName)
{
return fileName.GetExt() == "bin";
}
开发者ID:robojan,项目名称:EMGL,代码行数:4,代码来源:BinaryDataGenerator.cpp
示例10: DoClangFormat
bool CodeFormatter::DoClangFormat(const wxFileName& filename,
wxString& formattedOutput,
int& cursorPosition,
int startOffset,
int length,
const FormatOptions& options)
{
// clang-format
// Build the command line to run
if(options.GetClangFormatExe().IsEmpty()) {
return false;
}
wxString command, file;
clClangFormatLocator locator;
double version = locator.GetVersion(options.GetClangFormatExe());
command << options.GetClangFormatExe();
file = filename.GetFullPath();
::WrapWithQuotes(command);
::WrapWithQuotes(file);
command << options.ClangFormatOptionsAsString(filename, version);
if(cursorPosition != wxNOT_FOUND) {
command << " -cursor=" << cursorPosition;
}
if(startOffset != wxNOT_FOUND && length != wxNOT_FOUND) {
command << " -offset=" << startOffset << " -length=" << length;
}
command << " " << file;
// Wrap the command in the local shell
::WrapInShell(command);
// Log the command
CL_DEBUG("CodeForamtter: running:\n%s\n", command);
// Execute clang-format and reand the output
formattedOutput.Clear();
IProcess::Ptr_t clangFormatProc(
::CreateSyncProcess(command, IProcessCreateDefault | IProcessCreateWithHiddenConsole));
CHECK_PTR_RET_FALSE(clangFormatProc);
clangFormatProc->WaitForTerminate(formattedOutput);
CL_DEBUG("clang-format returned with:\n%s\n", formattedOutput);
if(formattedOutput.IsEmpty()) {
// crash?
return false;
}
// The first line contains the cursor position
if(cursorPosition != wxNOT_FOUND) {
wxString metadata = formattedOutput.BeforeFirst('\n');
JSONRoot root(metadata);
cursorPosition = root.toElement().namedObject("cursor").toInt(wxNOT_FOUND);
formattedOutput = formattedOutput.AfterFirst('\n');
}
return true;
}
开发者ID:05storm26,项目名称:codelite,代码行数:62,代码来源:codeformatter.cpp
示例11: operator
bool operator()(const wxFileName& one, const wxFileName& two) const {
return one.GetModificationTime().GetTicks() > two.GetModificationTime().GetTicks();
}
开发者ID:blitz-research,项目名称:codelite,代码行数:3,代码来源:compilation_database.cpp
示例12: tok
/** @brief Processes a single line from a LOF text file, doing whatever is
* indicated on the line.
*
* This function should just return for lines it cannot deal with, and the
* caller will continue to the next line of the input file
*/
void LOFImportFileHandle::lofOpenFiles(wxString* ln)
{
wxStringTokenizer tok(*ln, wxT(" "));
wxStringTokenizer temptok1(*ln, wxT("\""));
wxStringTokenizer temptok2(*ln, wxT(" "));
int tokenplace = 0;
wxString targetfile;
wxString tokenholder = tok.GetNextToken();
if (tokenholder.IsSameAs(wxT("window"), false))
{
// set any duration/offset factors for last window, as all files were called
doDuration();
doScrollOffset();
if (windowCalledOnce)
{
mProject = CreateNewAudacityProject();
}
windowCalledOnce = true;
while (tok.HasMoreTokens())
{
tokenholder = tok.GetNextToken();
if (tokenholder.IsSameAs(wxT("offset"), false))
{
if (tok.HasMoreTokens())
tokenholder = tok.GetNextToken();
if (Internat::CompatibleToDouble(tokenholder, &scrollOffset))
{
callScrollOffset = true;
}
else
{
/* i18n-hint: You do not need to translate "LOF" */
wxMessageBox(_("Invalid window offset in LOF file."),
/* i18n-hint: You do not need to translate "LOF" */
_("LOF Error"), wxOK | wxCENTRE);
}
if (tok.HasMoreTokens())
tokenholder = tok.GetNextToken();
}
if (tokenholder.IsSameAs(wxT("duration"), false))
{
if (tok.HasMoreTokens())
tokenholder = tok.GetNextToken();
if (Internat::CompatibleToDouble(tokenholder, &durationFactor))
{
callDurationFactor = true;
}
else
{
/* i18n-hint: You do not need to translate "LOF" */
wxMessageBox(_("Invalid duration in LOF file."),
/* i18n-hint: You do not need to translate "LOF" */
_("LOF Error"), wxOK | wxCENTRE);
}
} // End if statement
if (tokenholder.IsSameAs(wxT("#")))
{
// # indicates comments; ignore line
tok = wxStringTokenizer(wxT(""), wxT(" "));
}
} // End while loop
} // End if statement handling "window" lines
else if (tokenholder.IsSameAs(wxT("file"), false))
{
// To identify filename and open it
tokenholder = temptok1.GetNextToken();
targetfile = temptok1.GetNextToken();
// If path is relative, make absolute path from LOF path
if(!wxIsAbsolutePath(targetfile)) {
wxFileName fName(targetfile);
fName.Normalize(wxPATH_NORM_ALL, mLOFFileName.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR));
if(fName.FileExists()) {
targetfile = fName.GetFullPath();
}
}
#ifdef USE_MIDI
// If file is a midi
if (targetfile.AfterLast(wxT('.')).IsSameAs(wxT("mid"), false)
|| targetfile.AfterLast(wxT('.')).IsSameAs(wxT("midi"), false))
//.........这里部分代码省略.........
开发者ID:rbuj,项目名称:audacity,代码行数:101,代码来源:ImportLOF.cpp
示例13: AddTree
bool wxFsEventsFileSystemWatcher::AddTree(const wxFileName& path, int events,
const wxString& filespec)
{
if (!path.DirExists())
{
return false;
}
wxString canonical = GetCanonicalPath(path);
if ( canonical.empty() )
{
return false;
}
CFRunLoopRef cfLoop = CFRunLoopGetCurrent();
wxASSERT_MSG(
cfLoop,
"there must be a current event loop; this file watcher needs it."
);
if ( ! cfLoop )
{
return false;
}
if ( m_streams.find(canonical) != m_streams.end() )
{
// How to take into account filespec
// if client adds a watch for /home/*.cpp
// and then on another call wants to add a
// call to /home/*.h
// Ideally we should not create another watch
// however we would need to keep both filespecs
// around, which we don't do now.
return false;
}
// Will need to pass the desired event flags
// and filespec to our callback via the context
// we make sure to give the context a cleanup
// callback.
FSEventStreamContext ctx;
wxFSEventWatcherContext* watcherContext = new wxFSEventWatcherContext(
this, events, filespec.Clone()
);
ctx.version = 0;
ctx.info = watcherContext;
ctx.retain = NULL;
ctx.release = &wxDeleteContext;
ctx.copyDescription = NULL;
CFTimeInterval latency = 0.2;
wxMacUniCharBuffer pathChars(path.GetPath());
CFStringRef pathRef = CFStringCreateWithCharacters(
kCFAllocatorDefault,
pathChars.GetBuffer(),
pathChars.GetChars()
);
CFArrayRef pathRefs = CFArrayCreate(
kCFAllocatorDefault, (const void**)&pathRef, 1, NULL
);
FSEventStreamCreateFlags flags = kFSEventStreamCreateFlagWatchRoot
| kFSEventStreamCreateFlagFileEvents;
FSEventStreamRef stream = FSEventStreamCreate(
kCFAllocatorDefault,
&wxFSEventCallback,
&ctx,
pathRefs, kFSEventStreamEventIdSinceNow,
latency, flags);
bool started = false;
if ( stream )
{
FSEventStreamScheduleWithRunLoop(stream, cfLoop, kCFRunLoopDefaultMode);
started = FSEventStreamStart(stream);
if ( started )
{
m_streams[canonical] = stream;
}
}
// cleanup the paths, as we own the pointers
CFRelease(pathRef);
CFRelease(pathRefs);
wxASSERT_MSG(stream, "could not create FS stream");
return started;
}
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:85,代码来源:fswatcher_fsevents.cpp
示例14: GetSettingsManager
void CMakePlugin::OnExportMakefile(clBuildEvent& event)
{
const wxString project = event.GetProjectName();
const wxString config = event.GetConfigurationName();
// Get settings
const CMakeProjectSettings* settings = GetSettingsManager()->GetProjectSettings(project, config);
// Doesn't exists or not enabled
if(!settings || !settings->enabled) {
// Unable to export makefile
event.Skip();
return;
}
// Get project directory - this is directory where the makefile is stored
const wxFileName projectDir = GetProjectDirectory(project);
// Targets forward inspired by
// https://gist.github.com/doitian/4978329
// Content of the generated makefile
wxString content = wxString() << "# Generated by CMakePlugin\n"
".PHONY: all clean $(MAKECMDGOALS)\n"
"\n";
// Parent project is set
if(!settings->parentProject.IsEmpty()) {
// Configure parent project instead
const wxString& parentProject = settings->parentProject;
settings = GetSettingsManager()->GetProjectSettings(parentProject, config);
// Parent project not found
if(!settings || !settings->enabled) {
CL_ERROR("Unable to find or not enabled parent project "
"'" +
parentProject + "' for project '" + project + "'");
return;
}
// Get parent project directory
wxFileName parentProjectDir = GetProjectDirectory(parentProject);
parentProjectDir.MakeRelativeTo(projectDir.GetFullPath());
// Path is relative so UNIX path system can be used
const wxString parentProjectDirEsc = parentProjectDir.GetPath(wxPATH_NO_SEPARATOR, wxPATH_UNIX);
// Redirect make to the parent project
content << "# Parent project\n"
"PARENT := " << parentProjectDirEsc << "\n"
"PARENT_MAKEFILE := " << parentProject
<< ".mk\n"
"\n"
"all:\n"
"\t$(MAKE) -C \"$(PARENT)\" -f \"$(PARENT_MAKEFILE)\" " << project
<< "\n"
"\n"
"clean:\n"
"\t$(MAKE) -C \"$(PARENT)\" -f \"$(PARENT_MAKEFILE)\" " << project << " clean\n"
"\n";
} else {
// Macro expander
// FIXME use IMacroManager (unable to find it yet)
MacroManager* macro = MacroManager::Instance();
wxASSERT(macro);
// Get variables
// Expand variables for final project
const wxString cmake = GetConfiguration()->GetProgramPath();
wxFileName sourceDir =
wxFileName::DirName(macro->Expand(settings->sourceDirectory, GetManager(), project, config));
wxFileName buildDir =
wxFileName::DirName(macro->Expand(settings->buildDirectory, GetManager(), project, config));
// Source dir must be relative to build directory (here is cmake called)
sourceDir.MakeRelativeTo(buildDir.GetFullPath());
// Build dir must be relative to project directory
buildDir.MakeRelativeTo(projectDir.GetFullPath());
// Relative paths
const wxString sourceDirEsc = sourceDir.GetPath(wxPATH_NO_SEPARATOR, wxPATH_UNIX);
const wxString buildDirEsc = buildDir.GetPath(wxPATH_NO_SEPARATOR, wxPATH_UNIX);
// Generated makefile
content << "CMAKE := \"" << cmake << "\"\n"
"BUILD_DIR := " << buildDirEsc << "\n"
"SOURCE_DIR := " << sourceDirEsc
<< "\n"
"CMAKE_ARGS := " << CreateArguments(*settings, *m_configuration)
<< "\n"
"\n"
"# Building project(s)\n"
"$(or $(lastword $(MAKECMDGOALS)), all): $(BUILD_DIR)/Makefile\n"
"\t$(MAKE) -C \"$(BUILD_DIR)\" $(MAKECMDGOALS)\n"
"\n"
"# Building directory\n"
"$(BUILD_DIR):\n"
"\t$(CMAKE) -E make_directory \"$(BUILD_DIR)\"\n"
//.........这里部分代码省略.........
开发者ID:kaustubhcs,项目名称:codelite,代码行数:101,代码来源:CMakePlugin.cpp
示例15: make
//~~ void RunMake(const AdeConfiguration& configuration, const wxString& target) [AstadeFrame] ~~
wxConfigBase* theConfig = wxConfigBase::Get();
wxFileName make(theConfig->Read(wxS("Tools/Make")));
wxFileName configurationPath = configuration.GetFileName();
configurationPath.MakeAbsolute();
wxFileName componentPath = configuration.GetFileName();
componentPath.MakeAbsolute();
componentPath.RemoveLastDir();
AdeComponent* component = dynamic_cast<AdeComponent*>(AdeModelElement::CreateNewElement(componentPath));
assert(component);
wxString command = make.GetFullPath() + wxS(" -C \"") +
configurationPath.GetPath() +
wxS("\" ") +
wxS("\"TRACECLASSES=") + GetTraceClassList() + wxS("\" \"TARGET=") +
component->GetLabel() +
wxS("\" ") + target;
delete component;
assert(myMakeOutput);
myMakeOutput->SetNormalStyle();
myMakeOutput->TheEdit()->Clear();
*(myMakeOutput->TheEdit()) << wxS("make started ... \n");
myMakeOutput->SetactiveConfiguration(configurationPath);
myMakeOutput->Show();
myMakeOutput->Maximize(false); //true, maximizes the window, otherwise it restores it.
开发者ID:Astade,项目名称:Astade,代码行数:31,代码来源:code.cpp
示例16: LOG_I
AVSValue AvisynthVideoProvider::Open(wxFileName const& fname, wxString const& extension) {
IScriptEnvironment *env = avs.GetEnv();
char *videoFilename = env->SaveString(fname.GetShortPath().mb_str(csConvLocal));
// Avisynth file, just import it
if (extension == ".avs") {
LOG_I("avisynth/video") << "Opening .avs file with Import";
decoderName = "Avisynth/Import";
return env->Invoke("Import", videoFilename);
}
// Open avi file with AviSource
if (extension == ".avi") {
LOG_I("avisynth/video") << "Opening .avi file with AviSource";
try {
const char *argnames[2] = { 0, "audio" };
AVSValue args[2] = { videoFilename, false };
decoderName = "Avisynth/AviSource";
return env->Invoke("AviSource", AVSValue(args,2), argnames);
}
// On Failure, fallback to DSS
catch (AvisynthError &err) {
LOG_E("avisynth/video") << err.msg;
LOG_I("avisynth/video") << "Failed to open .avi file with AviSource, trying DirectShowSource";
}
}
// Open d2v with mpeg2dec3
if (extension == ".d2v" && env->FunctionExists("Mpeg2Dec3_Mpeg2Source")) {
LOG_I("avisynth/video") << "Opening .d2v file with Mpeg2Dec3_Mpeg2Source";
AVSValue script = env->Invoke("Mpeg2Dec3_Mpeg2Source", videoFilename);
decoderName = "Avisynth/Mpeg2Dec3_Mpeg2Source";
//if avisynth is 2.5.7 beta 2 or newer old mpeg2decs will crash without this
if (env->FunctionExists("SetPlanarLegacyAlignment")) {
AVSValue args[2] = { script, true };
script = env->Invoke("SetPlanarLegacyAlignment", AVSValue(args,2));
}
return script;
}
// If that fails, try opening it with DGDecode
if (extension == ".d2v" && env->FunctionExists("DGDecode_Mpeg2Source")) {
LOG_I("avisynth/video") << "Opening .d2v file with DGDecode_Mpeg2Source";
decoderName = "DGDecode_Mpeg2Source";
return env->Invoke("Avisynth/Mpeg2Source", videoFilename);
//note that DGDecode will also have issues like if the version is too
// ancient but no sane person would use that anyway
}
if (extension == ".d2v" && env->FunctionExists("Mpeg2Source")) {
LOG_I("avisynth/video") << "Opening .d2v file with other Mpeg2Source";
AVSValue script = env->Invoke("Mpeg2Source", videoFilename);
decoderName = "Avisynth/Mpeg2Source";
//if avisynth is 2.5.7 beta 2 or newer old mpeg2decs will crash without this
if (env->FunctionExists("SetPlanarLegacyAlignment"))
script = env->Invoke("SetPlanarLegacyAlignment", script);
return script;
}
// Try loading DirectShowSource2
if (!env->FunctionExists("dss2")) {
wxFileName dss2path(StandardPaths::DecodePath("?data/avss.dll"));
if (dss2path.FileExists()) {
env->Invoke("LoadPlugin", env->SaveString(dss2path.GetFullPath().mb_str(csConvLocal)));
}
}
// If DSS2 loaded properly, try using it
if (env->FunctionExists("dss2")) {
LOG_I("avisynth/video") << "Opening file with DSS2";
decoderName = "Avisynth/DSS2";
return env->Invoke("DSS2", videoFilename);
}
// Try DirectShowSource
// Load DirectShowSource.dll from app dir if it exists
wxFileName dsspath(StandardPaths::DecodePath("?data/DirectShowSource.dll"));
if (dsspath.FileExists()) {
env->Invoke("LoadPlugin",env->SaveString(dsspath.GetFullPath().mb_str(csConvLocal)));
}
// Then try using DSS
if (env->FunctionExists("DirectShowSource")) {
const char *argnames[3] = { 0, "video", "audio" };
AVSValue args[3] = { videoFilename, true, false };
decoderName = "Avisynth/DirectShowSource";
warning = "Warning! The file is being opened using Avisynth's DirectShowSource, which has unreliable seeking. Frame numbers might not match the real number. PROCEED AT YOUR OWN RISK!";
LOG_I("avisynth/video") << "Opening file with DirectShowSource";
return env->Invoke("DirectShowSource", AVSValue(args,3), argnames);
}
// Failed to find a suitable function
LOG_E("avisynth/video") << "DSS function not found";
throw VideoNotSupported("No function suitable for opening the video found");
}
开发者ID:Gpower2,项目名称:Aegisub,代码行数:99,代码来源:video_provider_avs.cpp
示例17: HasFile
bool PHPProject::HasFile(const wxFileName& filename) const
{
return filename.GetFullPath().StartsWith(GetFilename().GetPath());
}
开发者ID:05storm26,项目名称:codelite,代码行数:4,代码来源:php_project.cpp
示例18: printf
bool DirManager::EnsureSafeFilename(wxFileName fName)
{
// Quick check: If it's not even in our alias list,
// then the file name is A-OK.
#if 0
printf("file name: %s\n", fName.GetFullPath().c_str());
printf("string list:\n");
wxStringListNode *node = aliasList.GetFirst();
while (node)
{
wxString string = node->GetData();
printf("%s\n", string.c_str());
node = node->GetNext();
}
#endif
if (!aliasList.Member(fName.GetFullPath()))
return true;
// If any of the following commands fail, your guess is as
// good as mine why. The following error message is the
// best we can do - we'll use it if any of the renames,
// creates, or deletes fail.
wxString errStr =
_( "Error: is directory write-protected or disk full?" );
/* i18n-hint: 'old' is part of a filename used when a file is renamed. */
// Figure out what the new name for the existing file would be.
/* i18n-hint: e.g. Try to go from "mysong.wav" to "mysong-old1.wav". */
// Keep trying until we find a filename that doesn't exist.
wxFileName renamedFile = fName;
int i = 0;
do {
i++;
/* i18n-hint: This is the pattern for filenames that are created
when a file needs to be backed up to a different name. For
example, mysong would become mysong-old1, mysong-old2, etc. */
renamedFile.SetName(wxString::Format(_("%s-old%d"), fName.GetName().c_str(), i));
} while (wxFileExists(FILENAME(renamedFile.GetFullPath())));
// Test creating a file by that name to make sure it will
// be possible to do the rename
wxFile testFile(FILENAME(renamedFile.GetFullPath()), wxFile::write);
if (!testFile.IsOpened()) {
wxMessageBox(errStr);
return false;
}
if (!wxRemoveFile(FILENAME(renamedFile.GetFullPath()))) {
wxMessageBox(errStr);
return false;
}
printf(_("Renamed file: %s\n"), (const char *)renamedFile.GetFullPath());
// Go through our block files and see if any indeed point to
// the file we're concerned about. If so, point the block file
// to the renamed file and when we're done, perform the rename.
bool needToRename = false;
wxBusyCursor busy;
blockFileHash->BeginFind();
wxNode *n = blockFileHash->Next();
while(n) {
BlockFile *b = (BlockFile *)n->GetData();
// don't worry, we don't rely on this cast unless IsAlias is true
AliasBlockFile *ab = (AliasBlockFile*)b;
if (b->IsAlias() && ab->GetAliasedFile() == fName) {
needToRename = true;
printf(_("Changing block %s\n"), (const char *)b->GetFileName().GetFullName());
ab->ChangeAliasedFile(renamedFile);
}
n = blockFileHash->Next();
}
if (needToRename) {
if (!wxRenameFile(FILENAME(fName.GetFullPath()),
FILENAME(renamedFile.GetFullPath()))) {
// ACK!!! The renaming was unsuccessful!!!
// (This shouldn't happen, since we tried creating a
// file of this name and then deleted it just a
// second earlier.) But we'll handle this scenario
// just in case!!!
// Put things back where they were
blockFileHash->BeginFind();
n = blockFileHash->Next();
while(n) {
BlockFile *b = (BlockFile *)n->GetData();
AliasBlockFile *ab = (AliasBlockFile*)b;
if (b->IsAlias() && ab->GetAliasedFile() == renamedFile)
ab->ChangeAliasedFile(fName);
n = blockFileHash->Next();
}
//.........这里部分代码省略.........
开发者ID:Kirushanr,项目名称:audacity,代码行数:101,代码来源:DirManager.cpp
示例19: BlockFile
/// Constructs a SimpleBlockFile based on sample data and writes
/// it to disk.
///
/// @param baseFileName The filename
|
请发表评论