本文整理汇总了C++中wxFileName::Mkdir方法的典型用法代码示例。如果您正苦于以下问题:C++ wxFileName::Mkdir方法的具体用法?C++ wxFileName::Mkdir怎么用?C++ wxFileName::Mkdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxFileName
的用法示例。
在下文中一共展示了wxFileName::Mkdir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetUserDir
/*
This routine is platform-independent.
MMEX is a portable application which means ability to to run
without installation, for example, from USB flash drive.
If mmex finds mmexini.db3 in its folder, it assumes portable
mode and GetUserDir() in such case points to that folder.
FIXME: security issue - temp files will be created on host filesystem.
*/
const wxFileName mmex::GetUserDir(bool create)
{
static wxFileName fname;
if (!fname.IsOk())
{
fname = getSettingsPathPortable();
bool portable_file_ok = fname.IsFileWritable() && fname.IsFileReadable();
if (!portable_file_ok)
{
fname.AssignDir(wxStandardPaths::Get().GetUserDataDir());
if (create && !fname.DirExists())
{
portable_file_ok = fname.Mkdir(0700, wxPATH_MKDIR_FULL); // 0700 - octal, "111 000 000"
wxASSERT(portable_file_ok);
}
}
fname.SetFullName(wxGetEmptyString());
}
return fname;
}
示例2: makeDirs
bool AmeJobMan::makeDirs(wxFileName f){
wxFileName p = f.GetPath();
if(f.DirExists())
return true;
if(!p.DirExists() && !makeDirs(p))
return false;
return f.Mkdir();
}
示例3: MakeSureDirExists
bool Converter::MakeSureDirExists(wxFileName& path) {
wxFileName parent(path);
parent.RemoveLastDir();
if (parent.GetDirCount() > 0 && !parent.DirExists()) {
if (!MakeSureDirExists(parent)) {
return false;
}
}
if (!path.DirExists()) {
return path.Mkdir();
}
return true;
}
示例4: GetWatchDir
// static helpers
static const wxFileName& GetWatchDir()
{
static wxFileName dir;
if (dir.DirExists())
return dir;
wxString tmp = wxStandardPaths::Get().GetTempDir();
dir.AssignDir(tmp);
// XXX look for more unique name? there is no function to generate
// unique filename, the file always get created...
dir.AppendDir("fswatcher_test");
CPPUNIT_ASSERT(!dir.DirExists());
CPPUNIT_ASSERT(dir.Mkdir());
return dir;
}
示例5: DoAddFileWithContent
void PHPWorkspaceView::DoAddFileWithContent(const wxTreeItemId& folderId,
const wxFileName& filename,
const wxString& content)
{
// file can only be added to a folder
ItemData* data = DoGetItemData(folderId);
if(!data || !data->IsFolder()) {
return;
}
if(filename.FileExists()) {
// a file with this name already exists
wxMessageBox(_("A file with same name already exists!"), wxT("CodeLite"), wxOK | wxCENTER | wxICON_WARNING);
return;
}
FileExtManager::FileType type = FileExtManager::GetType(filename.GetFullName());
// Create the file
const wxString __EOL__ = EditorConfigST::Get()->GetOptions()->GetEOLAsString();
// Make sure that the path exists
filename.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
wxFFile fp;
if(fp.Open(filename.GetFullPath(), wxT("w+"))) {
// if its is a PHP file, write the php tag at to the top of the file
if(type == FileExtManager::TypePhp) {
fp.Write(wxString() << "<?php " << __EOL__ << __EOL__ << content);
}
fp.Close();
}
// add the new file
wxString project_name = DoGetSelectedProject();
wxString folder_name = data->GetFolderPath();
PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProject(project_name);
CHECK_PTR_RET(pProject);
PHPFolder::Ptr_t pFolder = pProject->Folder(folder_name);
CHECK_PTR_RET(pFolder);
if(PHPWorkspace::Get()->AddFile(project_name, folder_name, filename.GetFullPath())) {
wxArrayString filesToAdd;
filesToAdd.Add(filename.GetFullPath());
DoAddFilesToTreeView(folderId, pProject, pFolder, filesToAdd);
}
// Open the newly added file
m_mgr->OpenFile(filename.GetFullPath());
IEditor* editor = m_mgr->GetActiveEditor();
if(editor) {
editor->SetCaretAt(editor->GetLength());
}
// Notify plugins about new files was added to workspace
wxArrayString files;
files.Add(filename.GetFullPath());
// Notify the plugins
clCommandEvent evtFilesAdded(wxEVT_PROJ_FILE_ADDED);
evtFilesAdded.SetStrings(files);
EventNotifier::Get()->AddPendingEvent(evtFilesAdded);
}