本文整理汇总了C++中wxFileName::GetFullName方法的典型用法代码示例。如果您正苦于以下问题:C++ wxFileName::GetFullName方法的具体用法?C++ wxFileName::GetFullName怎么用?C++ wxFileName::GetFullName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxFileName
的用法示例。
在下文中一共展示了wxFileName::GetFullName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnumerateMemoryCard
//sets IsPresent if the file is valid, and derived properties (filename, formatted, size, etc)
bool EnumerateMemoryCard( McdSlotItem& dest, const wxFileName& filename, const wxDirName basePath )
{
dest.IsFormatted = false;
dest.IsPresent = false;
const wxString fullpath( filename.GetFullPath() );
if( !filename.FileExists() ) return false;
DevCon.WriteLn( fullpath );
wxFFile mcdFile( fullpath );
if( !mcdFile.IsOpened() ) return false; // wx should log the error for us.
if( mcdFile.Length() < (1024*528) )
{
Console.Warning( "... MemoryCard appears to be truncated. Ignoring." );
return false;
}
dest.IsPresent = true;
dest.Filename = filename;
if( filename.GetFullPath() == (basePath+filename.GetFullName()).GetFullPath() )
dest.Filename = filename.GetFullName();
dest.SizeInMB = (uint)(mcdFile.Length() / (1024 * 528 * 2));
dest.IsFormatted = IsMcdFormatted( mcdFile );
filename.GetTimes( NULL, &dest.DateModified, &dest.DateCreated );
return true;
}
示例2: 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
{
lc3_assemble(dummy_state, filename.GetFullPath().ToStdString(), false);
lc3_assemble(state, filename.GetFullPath().ToStdString());
}
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();
}
示例3: EnumerateMemoryCard
//sets IsPresent if the file is valid, and derived properties (filename, formatted, size, etc)
bool EnumerateMemoryCard( McdSlotItem& dest, const wxFileName& filename, const wxDirName basePath )
{
dest.IsFormatted = false;
dest.IsPresent = false;
dest.IsPSX = false;
dest.Type = MemoryCardType::MemoryCard_None;
const wxString fullpath( filename.GetFullPath() );
//DevCon.WriteLn( fullpath );
if ( filename.FileExists() ) {
// might be a memory card file
wxFFile mcdFile( fullpath );
if ( !mcdFile.IsOpened() ) { return false; } // wx should log the error for us.
wxFileOffset length = mcdFile.Length();
if( length < (1024*528) && length != 0x20000 )
{
Console.Warning( "... MemoryCard appears to be truncated. Ignoring." );
return false;
}
dest.SizeInMB = (uint)( length / ( 1024 * 528 * 2 ) );
if ( length == 0x20000 ) {
dest.IsPSX = true; // PSX memcard;
dest.SizeInMB = 1; // MegaBIT
}
dest.Type = MemoryCardType::MemoryCard_File;
dest.IsFormatted = IsMcdFormatted( mcdFile );
filename.GetTimes( NULL, &dest.DateModified, &dest.DateCreated );
} else if ( filename.DirExists() ) {
// might be a memory card folder
wxFileName superBlockFileName( fullpath, L"_pcsx2_superblock" );
if ( !superBlockFileName.FileExists() ) { return false; }
wxFFile mcdFile( superBlockFileName.GetFullPath() );
if ( !mcdFile.IsOpened() ) { return false; }
dest.SizeInMB = 0;
dest.Type = MemoryCardType::MemoryCard_Folder;
dest.IsFormatted = IsMcdFormatted( mcdFile );
superBlockFileName.GetTimes( NULL, &dest.DateModified, &dest.DateCreated );
} else {
// is neither
return false;
}
dest.IsPresent = true;
dest.Filename = filename;
if( filename.GetFullPath() == (basePath+filename.GetFullName()).GetFullPath() )
dest.Filename = filename.GetFullName();
return true;
}
示例4: IsHidden
bool FileUtils::IsHidden(const wxFileName& filename)
{
#ifdef __WXMSW__
DWORD dwAttrs = GetFileAttributes(filename.GetFullPath().c_str());
if(dwAttrs == INVALID_FILE_ATTRIBUTES) return false;
return (dwAttrs & FILE_ATTRIBUTE_HIDDEN) || (filename.GetFullName().StartsWith("."));
#else
// is it enough to test for file name?
return filename.GetFullName().StartsWith(".");
#endif
}
示例5: MakeNameUnique
// originally an ExportMultiple method. Append suffix if newName appears in otherNames.
void FileNames::MakeNameUnique(wxArrayString &otherNames, wxFileName &newName)
{
if (otherNames.Index(newName.GetFullName(), false) >= 0) {
int i=2;
wxString orig = newName.GetName();
do {
newName.SetName(wxString::Format(wxT("%s-%d"), orig.c_str(), i));
i++;
} while (otherNames.Index(newName.GetFullName(), false) >= 0);
}
otherNames.Add(newName.GetFullName());
}
示例6: throw
IFSTREAM_LINE_READER::IFSTREAM_LINE_READER( const wxFileName& aFileName ) throw( IO_ERROR ) :
m_fStream( aFileName.GetFullName().ToUTF8() )
{
if( !m_fStream.is_open() )
{
wxString msg = wxString::Format(
_( "Unable to open filename '%s' for reading" ), aFileName.GetFullPath().GetData() );
THROW_IO_ERROR( msg );
}
setStream( m_fStream );
source = aFileName.GetFullName();
}
示例7: IsSuffixOfPath
// Checks whether 'suffix' could be a suffix of 'path' and therefore represents
// the same path. This is used to check whether a relative path could represent
// the same path as absolute path. For instance, for
// suffix = sdk/globals.cpp
// path = /home/user/codeblocks/trunk/src/sdk/globals.cpp
// it returns true. The function expects that 'path' is normalized and compares
// 'path' with 'suffix' starting from the end of the path. When it reaches .. in
// 'suffix' it gives up (there is no way to check relative filename names
// exactly) and if the path compared so far is identical, it returns true
bool IsSuffixOfPath(wxFileName const & suffix, wxFileName const & path)
{
if (path.GetFullName() != suffix.GetFullName())
{
return false;
}
wxArrayString suffixDirArray = suffix.GetDirs();
wxArrayString pathDirArray = path.GetDirs();
int j = pathDirArray.GetCount() - 1;
for (int i = suffixDirArray.GetCount() - 1; i >= 0; i--)
{
if (suffixDirArray[i] == _T(".") || suffixDirArray[i] == _T(""))
{
// skip paths like /./././ and ////
continue;
}
if (j < 0)
{
// suffix has more directories than path - cannot represent the same path
return false;
}
if (suffixDirArray[i] == _T(".."))
{
// suffix contains ".." - from now on we cannot precisely determine
// whether suffix and path match - we assume that they do
return true;
}
else if (suffixDirArray[i] != pathDirArray[j])
{
// the corresponding directories of the two paths differ
return false;
}
j--;
}
if (suffix.IsAbsolute() && (j >= 0 || suffix.GetVolume() != path.GetVolume()))
{
return false;
}
// 'suffix' is a suffix of 'path'
return true;
}
示例8: WildMatch
bool FileUtils::WildMatch(const wxString& mask, const wxFileName& filename)
{
wxArrayString incMasks;
wxArrayString excMasks;
SplitMask(mask, incMasks, excMasks);
if(incMasks.Index("*") != wxNOT_FOUND) {
// If one of the masks is plain "*" - we match everything
return true;
}
wxString lcFilename = filename.GetFullName().Lower();
// Try to the "exclude" masking first
for(size_t i = 0; i < excMasks.size(); ++i) {
const wxString& pattern = excMasks.Item(i);
if((!pattern.Contains("*") && lcFilename == pattern) ||
(pattern.Contains("*") && ::wxMatchWild(pattern, lcFilename))) {
// use exact match
return false;
}
}
for(size_t i = 0; i < incMasks.size(); ++i) {
const wxString& pattern = incMasks.Item(i);
if((!pattern.Contains("*") && lcFilename == pattern) ||
(pattern.Contains("*") && ::wxMatchWild(pattern, lcFilename))) {
// use exact match
return true;
}
}
return false;
}
示例9: FileHistoryPopupMenu
void wxExFrameWithHistory::FileHistoryPopupMenu()
{
wxMenu* menu = new wxMenu();
for (int i = 0; i < m_FileHistory.GetCount(); i++)
{
const wxFileName file(m_FileHistory.GetHistoryFile(i));
if (file.FileExists())
{
wxMenuItem* item = new wxMenuItem(
menu,
wxID_FILE1 + i,
file.GetFullName());
item->SetBitmap(wxTheFileIconsTable->GetSmallImageList()->GetBitmap(
wxExGetIconID(file)));
menu->Append(item);
}
}
if (menu->GetMenuItemCount() > 0)
{
menu->AppendSeparator();
menu->Append(ID_CLEAR, wxGetStockLabel(wxID_CLEAR));
PopupMenu(menu);
}
delete menu;
}
示例10: LibraryFileBrowser
bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
const wxString& wildcard, const wxString& ext,
bool isDirectory )
{
wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
aFilename.SetExt( ext );
#ifndef __WXMAC__
if( isDirectory && doOpen )
{
wxDirDialog dlg( this, prompt, Prj().GetProjectPath(),
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return false;
aFilename = dlg.GetPath();
aFilename.SetExt( ext );
}
else
#endif
{
wxFileDialog dlg( this, prompt, Prj().GetProjectPath(), aFilename.GetFullName() ,
wildcard, doOpen ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
: wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return false;
aFilename = dlg.GetPath();
aFilename.SetExt( ext );
}
return true;
}
示例11: OnMenuExport
void BundlePane::OnMenuExport(wxCommandEvent& WXUNUSED(event)) {
const wxTreeItemId selItem = m_bundleTree->GetSelection();
if (!selItem.IsOk()) return;
// Get the item name
const BundleItemData* data = (BundleItemData*)m_bundleTree->GetItemData(selItem);
wxString name;
if (data->IsBundle()) {
const wxFileName bundlePath = m_plistHandler.GetBundlePath(data->m_bundleId);
name = bundlePath.GetDirs().Last();
}
else {
const wxFileName bundlePath = m_plistHandler.GetBundleItemPath(data->m_type, data->m_bundleId, data->m_itemId);
name = bundlePath.GetFullName();
}
// Get destination path from user
const wxString msg = data->IsBundle() ? _("Export Bundle as..") : _("Export Bundle Item as");
wxFileDialog dlg(this, msg, wxEmptyString, name, wxFileSelectorDefaultWildcardStr, wxFD_SAVE);
if (dlg.ShowModal() != wxID_OK) return;
const wxString path = dlg.GetPath();
if (path.empty()) return;
// Export the item
if (data->IsBundle()) {
wxFileName dstPath;
dstPath.AssignDir(path);
m_plistHandler.ExportBundle(dstPath, data->m_bundleId);
}
else m_plistHandler.ExportBundleItem(path, data->m_type, data->m_bundleId, data->m_itemId);
}
示例12: GetRelativeFile
// See IsAdminDirTopLevel
const wxString wxExVCS::GetRelativeFile(
const wxString& admin_dir,
const wxFileName& fn) const
{
// The .git dir only exists in the root, so check all components.
wxFileName root(fn);
wxArrayString as;
while (root.DirExists() && root.GetDirCount() > 0)
{
wxFileName path(root);
path.AppendDir(admin_dir);
if (path.DirExists() && !path.FileExists())
{
wxString relative_file;
for (int i = as.GetCount() - 1; i >= 0; i--)
{
relative_file += as[i] + "/";
}
return relative_file + fn.GetFullName();
}
as.Add(root.GetDirs().Last());
root.RemoveLastDir();
}
return wxEmptyString;
}
示例13: WinPathToCygwin
wxString eDocumentPath::WinPathToCygwin(const wxFileName& path) {
wxASSERT(path.IsOk() && path.IsAbsolute());
#ifndef __WXMSW__
return path.GetFullPath();
#else
wxString fullpath = path.GetFullPath();
// Check if we have a foward-slash unc path; cygwin can handle these directly.
if (fullpath.StartsWith(wxT("//"))) {
return fullpath;
}
// Check if we have a backslash unc path; convert to forward slash and pass on.
if (fullpath.StartsWith(wxT("\\\\"))) {
fullpath.Replace(wxT("\\"), wxT("/"));
return fullpath;
}
// Convert C:\... to /cygdrive/c/...
wxString unixPath = eDocumentPath::s_cygdrivePrefix + path.GetVolume().Lower();
// Convert slashs in path segments
const wxArrayString& dirs = path.GetDirs();
for (unsigned int i = 0; i < dirs.GetCount(); ++i) {
unixPath += wxT('/') + dirs[i];
}
// Add the filename, if there is one
if (path.HasName()) unixPath += wxT('/') + path.GetFullName();
return unixPath;
#endif
}
示例14: DoOpenImageViewer
void MainBook::DoOpenImageViewer(const wxFileName& filename)
{
clImageViewer* imageViewer = new clImageViewer(m_book, filename);
size_t pos = m_book->GetPageCount();
m_book->AddPage(imageViewer, filename.GetFullName(), true);
m_book->SetPageToolTip(pos, filename.GetFullPath());
}
示例15: InsertMod
void Instance::InsertMod(size_t index, const wxFileName &source)
{
wxFileName dest(Path::Combine(GetInstModsDir().GetFullPath(), source.GetFullName()));
if (!source.SameAs(dest))
{
wxCopyFile(source.GetFullPath(), dest.GetFullPath());
}
dest.MakeRelativeTo();
SetNeedsRebuild();
int oldIndex = Find(modList.begin(), modList.end(), [&dest] (Mod mod) -> bool
{ return mod.GetFileName().SameAs(dest); });
if (oldIndex != -1)
{
modList.erase(modList.begin() + oldIndex);
}
if (index >= modList.size())
modList.push_back(Mod(dest));
else
modList.insert(modList.begin() + index, Mod(dest));
SaveModList();
}