当前位置: 首页>>代码示例>>C++>>正文


C++ wxFileName::Mkdir方法代码示例

本文整理汇总了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;
}
开发者ID:omalleypat,项目名称:moneymanagerex,代码行数:37,代码来源:paths.cpp

示例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();
}
开发者ID:arucard21,项目名称:AniDB,代码行数:8,代码来源:ame-job-man.cpp

示例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;
}
开发者ID:nagyist,项目名称:simple-photo,代码行数:13,代码来源:Converter.cpp

示例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;
    }
开发者ID:hazeeq090576,项目名称:wxWidgets,代码行数:19,代码来源:fswatchertest.cpp

示例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);
}
开发者ID:raresp,项目名称:codelite,代码行数:67,代码来源:php_workspace_view.cpp


注:本文中的wxFileName::Mkdir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。