• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PathIsRelative函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PathIsRelative函数的典型用法代码示例。如果您正苦于以下问题:C++ PathIsRelative函数的具体用法?C++ PathIsRelative怎么用?C++ PathIsRelative使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PathIsRelative函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: make_url

void web_page::set_base_url( const litehtml::tchar_t* base_url )
{
#ifndef LITEHTML_UTF8
	if(base_url)
	{
		if(PathIsRelative(base_url) && !PathIsURL(base_url))
		{
			make_url(base_url, m_url.c_str(), m_base_path);
		} else
		{
			m_base_path = base_url;
		}
	} else
	{
		m_base_path = m_url;
	}
#else
	LPWSTR bu = cairo_font::utf8_to_wchar(base_url);

	if(bu)
	{
		if(PathIsRelative(bu) && !PathIsURL(bu))
		{
			make_url(bu, m_url.c_str(), m_base_path);
		} else
		{
			m_base_path = bu;
		}
	} else
	{
		m_base_path = m_url;
	}
#endif
}
开发者ID:Grimace1975,项目名称:litebrowser,代码行数:34,代码来源:web_page.cpp


示例2: UpdateData

void CProjectNew::OnOK() 
{
	UpdateData(TRUE);

	if ( m_strName.IsEmpty() )
	{
		AfxMessageBox("Project name cannot be empty string.");
		return;
	}

	if ( PathIsRelative(m_strProjectDir) )
	{
		AfxMessageBox("Path to project directory must be absolute.");
		return;
	}

	if ( GetFileAttributes(m_strProjectDir)!=FILE_ATTRIBUTE_DIRECTORY &&
		!CreateDirectory(m_strProjectDir, NULL) )
	{
		AfxMessageBox("Cannot create project directory.");
		return;
	}
	
	int nItem = m_types.GetNextItem(-1, LVNI_SELECTED|LVNI_ALL);
	if ( nItem==-1 )
	{
		AfxMessageBox("Select project type.");
		return;
	}

	m_nType = m_types.GetItemData(nItem);

	CDialog::OnOK();
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:34,代码来源:ProjectNew.cpp


示例3: md_dir_set

/// Directory handling
/// ==================
BOOL md_dir_set(UINT32 dir_seg4, UINT16 dir_off) {

	CHAR dir_raw[MAX_PATH];
	TCHAR dir_ucs2[MAX_PATH];
	OEMCHAR *dos_dir;
	OEMCHAR *real_dir;
	BOOL ret;

	dos_dir = mem_read_sjis2ucs2(dir_raw, dir_ucs2, dir_seg4, dir_off, MAX_PATH);
	real_dir = md_drive_parse(dos_dir);
	
	// Changing to an empty string would lead to an error, crashing DOS
	if(real_dir[0] == _T('\0'))	{
		ret = 1;
	} else {
		ret = SetCurrentDirectory(real_dir);
	}
	// Don't set errors here!
	// Changing the registers quickly leads to
	// DOS crashing inside its own DIR function
	if(ret) {
		if(PathIsRelative(dos_dir)) {
			OEMCHAR tmp[MAX_PATH];
			lstrcpy(tmp, cur_dir);

			PathAddBackslash(tmp);
			lstrcat(tmp, real_dir);
			PathCanonicalize(cur_dir, tmp);
		} else {
			lstrcpy(cur_dir, real_dir);
		}
	}
	// Don't override DOS' handling of this one
	return FALSE;
}
开发者ID:LasDesu,项目名称:np2debug,代码行数:37,代码来源:md_dir.c


示例4: UpdateData

void CRenameDlg::OnOK()
{
	UpdateData();
	m_name.Trim();
	bool nameAllowed = ((m_originalName != m_name) || !m_renameRequired) && !m_name.IsEmpty();
	if (!nameAllowed)
	{
		m_bBalloonVisible = true;
		ShowEditBalloon(IDC_NAME, IDS_WARN_RENAMEREQUIRED, IDS_ERR_ERROR, TTI_ERROR);
		return;
	}

	CTGitPath path(m_name);
	if (!path.IsValidOnWindows() || !PathIsRelative(m_name))
	{
		m_bBalloonVisible = true;
		ShowEditBalloon(IDC_NAME, IDS_WARN_NOVALIDPATH, IDS_ERR_ERROR, TTI_ERROR);
		return;
	}

	if (m_pInputValidator)
	{
		CString sError = m_pInputValidator(IDC_NAME, m_name);
		if (!sError.IsEmpty())
		{
			m_bBalloonVisible = true;
			ShowEditBalloon(IDC_NAME, sError, CString(MAKEINTRESOURCE(IDS_ERR_ERROR)), TTI_ERROR);
			return;
		}
	}

	CHorizontalResizableStandAloneDialog::OnOK();
}
开发者ID:stahta01,项目名称:wxTortoiseGit,代码行数:33,代码来源:RenameDlg.cpp


示例5: expand_dirname

// converts relative path to absolute path
int expand_dirname(char *dirname, char *drive)
{
    char relative[MAX_PATH];
    char absolute[MAX_PATH];
    BOOL status;

    if (PathIsRelative(dirname))
    {
        _ASSERTE(strlen(drive) < NUM_OF(relative));
        strcpy(relative, drive);
        _ASSERTE(strlen(relative) + strlen(dirname) < NUM_OF(relative));
        strcat(relative, dirname);
        status = PathSearchAndQualify(relative, absolute, NUM_OF(absolute));
        _ASSERTE(status);
        if (':' == absolute[1])
        {
            drive[0] = absolute[0];
            drive[1] = absolute[1];
            drive[2] = 0;
            strcpy(dirname, &absolute[2]);
        }
        else
        {
            strcpy(dirname, absolute);
        }
    }
    fix_dirname(dirname);

    return 0;
}
开发者ID:rcatalano,项目名称:iterated-dynamics,代码行数:31,代码来源:os_win32.cpp


示例6: _wfsopen

/**
 * Returns the .git-path (if .git is a file, read the repository path and return it)
 * adminDir always ends with "\"
 */
bool GitAdminDir::GetAdminDirPath(const CString& projectTopDir, CString& adminDir, bool* isWorktree)
{
	CString wtAdminDir;
	if (!GetWorktreeAdminDirPath(projectTopDir, wtAdminDir))
		return false;

	CString pathToCommonDir = wtAdminDir + L"commondir";
	if (!PathFileExists(pathToCommonDir))
	{
		adminDir = wtAdminDir;
		if (isWorktree)
			*isWorktree = false;
		return true;
	}

	CAutoFILE pFile = _wfsopen(pathToCommonDir, L"rb", SH_DENYWR);
	if (!pFile)
		return false;

	int size = 65536;
	CStringA commonDirA;
	int length = (int)fread(commonDirA.GetBufferSetLength(size), sizeof(char), size, pFile);
	commonDirA.ReleaseBuffer(length);
	CString commonDir = CUnicodeUtils::GetUnicode(commonDirA);
	commonDir.TrimRight(L"\r\n");
	commonDir.Replace(L'/', L'\\');
	if (PathIsRelative(commonDir))
		adminDir = CPathUtils::BuildPathWithPathDelimiter(wtAdminDir + commonDir);
	else
		adminDir = CPathUtils::BuildPathWithPathDelimiter(commonDir);
	if (isWorktree)
		*isWorktree = true;
	return true;
}
开发者ID:YueLinHo,项目名称:TortoiseGit,代码行数:38,代码来源:GitAdminDir.cpp


示例7: GetLongPathname

CString CPathUtils::GetLongPathname(const CString& path)
{
	if (path.IsEmpty())
		return path;
	TCHAR pathbufcanonicalized[MAX_PATH]; // MAX_PATH ok.
	DWORD ret = 0;
	CString sRet;
	if (!PathIsURL(path) && PathIsRelative(path))
	{
		ret = GetFullPathName(path, 0, NULL, NULL);
		if (ret)
		{
			std::unique_ptr<TCHAR[]> pathbuf(new TCHAR[ret + 1]);
			if ((ret = GetFullPathName(path, ret, pathbuf.get(), NULL)) != 0)
				sRet = CString(pathbuf.get(), ret);
		}
	}
	else if (PathCanonicalize(pathbufcanonicalized, path))
	{
		ret = ::GetLongPathName(pathbufcanonicalized, NULL, 0);
		std::unique_ptr<TCHAR[]> pathbuf(new TCHAR[ret + 2]);
		ret = ::GetLongPathName(pathbufcanonicalized, pathbuf.get(), ret + 1);
		sRet = CString(pathbuf.get(), ret);
	}
	else
	{
		ret = ::GetLongPathName(path, NULL, 0);
		std::unique_ptr<TCHAR[]> pathbuf(new TCHAR[ret + 2]);
		ret = ::GetLongPathName(path, pathbuf.get(), ret + 1);
		sRet = CString(pathbuf.get(), ret);
	}
	if (ret == 0)
		return path;
	return sRet;
}
开发者ID:hfeeki,项目名称:TortoiseGit,代码行数:35,代码来源:PathUtils.cpp


示例8: vInitailizeSimSysInfo

void CSimSysManager::vSetConfigData(xmlNodePtr pNode)
{
    INT nWndPos = S_FALSE;
    vInitailizeSimSysInfo();
    if( NULL != pNode )
    {
        pNode = pNode->xmlChildrenNode;

        while (pNode != NULL)
        {
            if ((!xmlStrcmp(pNode->name, (const xmlChar*)"Window_Position")))
            {
                nWndPos =  xmlUtils::ParseWindowsPlacement(pNode, CGlobalObj::ouGetObj(m_eBus).m_wWindowPlacement);
            }
            if ((!xmlStrcmp(pNode->name, (const xmlChar*)"Sym_Path")))
            {
                xmlChar* key = xmlNodeListGetString(pNode->doc, pNode->xmlChildrenNode, 1);
                if(NULL != key)
                {
                    CString omStrFileName;
                    if(PathIsRelative((char*)key) == TRUE)
                    {
                        std::string omStrConfigFolder;
                        std::string omPath;
                        char configPath[MAX_PATH];
                        AfxGetMainWnd()->SendMessage(MSG_GET_CONFIGPATH, (WPARAM)configPath, 0);
                        CUtilFunctions::nGetBaseFolder(configPath, omStrConfigFolder );
                        char chAbsPath[MAX_PATH];
                        PathCombine(chAbsPath, omStrConfigFolder.c_str(), (char*)key);
                        omStrFileName = chAbsPath;
                    }
                    else
                    {
                        omStrFileName = (char*)key;
                    }
                    vLoadSimInfoFromConfiguration((char*)omStrFileName.GetBuffer(MAX_PATH));
                    xmlFree(key);
                }
            }
            pNode = pNode->next;
        }
    }
    if(nWndPos == S_FALSE)
    {
        /*CGlobalObj::ouGetObj(m_eBus).m_wWindowPlacement.rcNormalPosition.top  = 160;
        CGlobalObj::ouGetObj(m_eBus).m_wWindowPlacement.rcNormalPosition.left = 520;
        CGlobalObj::ouGetObj(m_eBus).m_wWindowPlacement.rcNormalPosition.right = 1458;
        CGlobalObj::ouGetObj(m_eBus).m_wWindowPlacement.rcNormalPosition.bottom = 686;
        CGlobalObj::ouGetObj(m_eBus).m_wWindowPlacement.showCmd = SW_NORMAL;*/
        CGlobalObj::ouGetObj(m_eBus).bGetDefaultValue(SIMSYS_WND_PLACEMENT, CGlobalObj::ouGetObj(m_eBus).m_wWindowPlacement);
    }
    if (m_pomSimSysTreeView != NULL)
    {
        if (m_pomSimSysTreeView->IsWindowVisible())
        {
            m_pomSimSysTreeView->bPopulateTree();
        }
    }
}
开发者ID:Huigang610,项目名称:busmaster-1,代码行数:59,代码来源:SimSysManager.cpp


示例9: MakeAbsolutePath

void CChordEaseApp::MakeAbsolutePath(CString& Path)
{
	if (PathIsRelative(Path)) {	// if path is relative
		CPathStr	AbsPath(GetDataFolderPath());
		AbsPath.Append(Path);
		Path = AbsPath;
	}
}
开发者ID:victimofleisure,项目名称:ChordEase,代码行数:8,代码来源:ChordEase.cpp


示例10: I_GetUserFileName

std::string I_GetUserFileName (const char *file)
{
#if defined(UNIX) && !defined(GEKKO)
	// return absolute or explicitly relative pathnames unmodified,
	// so launchers or CLI/console users have control over netdemo placement
	if (file &&
		(file[0] == PATHSEPCHAR || // /path/to/file
		(file[0] == '.' && file[1] == PATHSEPCHAR) || // ./file
		(file[0] == '.' && file[1] == '.' && file[2] == PATHSEPCHAR))) // ../file
		return std::string (file);

	std::string path = I_GetHomeDir();

	if(path[path.length() - 1] != PATHSEPCHAR)
		path += PATHSEP;

	path += ".odamex";

	struct stat info;
	if (stat (path.c_str(), &info) == -1)
	{
		if (mkdir (path.c_str(), S_IRUSR | S_IWUSR | S_IXUSR) == -1)
		{
			I_FatalError ("Failed to create %s directory:\n%s",
						  path.c_str(), strerror (errno));
		}
	}
	else
	{
		if (!S_ISDIR(info.st_mode))
		{
			I_FatalError ("%s must be a directory", path.c_str());
		}
	}

	path += PATHSEP;
	path += file;
#elif defined(_XBOX)
	std::string path = "T:";

	path += PATHSEP;
	path += file;
#else
	if (!PathIsRelative(file))
		return std::string (file);

	std::string path = I_GetBinaryDir();

	if(path[path.length() - 1] != PATHSEPCHAR)
		path += PATHSEP;

	path += file;
#endif

	FixPathSeparator(path);

	return path;
}
开发者ID:WChrisK,项目名称:OdaStats,代码行数:58,代码来源:i_system.cpp


示例11: LRCTitleFormatCallback

std::wstring LyricSourceLRC::getSavePath(const metadb_handle_ptr &track)
{
    std::string path = track->get_path();
    std::wstring wpath = EncodingFunc::ToUTF16(path.substr(boost::find_last(path, "://").end() - path.begin()));
    wpath = wpath.substr(0, wpath.find_last_of(L"."));
    if(track->get_subsong_index() != 0)
        wpath += boost::lexical_cast<std::wstring>(track->get_subsong_index());
    wpath += L".lrc";
    if(m_config["lrcsavepath"].length())
    {
        class LRCTitleFormatCallback : public main_thread_callback
        {
        private:
            HANDLE m_event;
            std::string *m_out;
            const std::string &m_format;
            const metadb_handle_ptr &m_track;
        public:
            LRCTitleFormatCallback(HANDLE event, std::string *out, const std::string &format, const metadb_handle_ptr &track) : m_event(event), m_format(format), m_out(out), m_track(track) {}

            virtual void callback_run()
            {
                core_api::ensure_main_thread();
                pfc::string8 out;
                service_ptr_t<titleformat_object> script;
                static_api_ptr_t<titleformat_compiler>()->compile(script, m_format.c_str());
                m_track->format_title(NULL, out, script, NULL);
                m_out->assign(out.get_ptr());
                SetEvent(m_event);
            }
        };
        std::wstring dirname = wpath.substr(0, wpath.find_last_of(L'\\') + 1);
        std::wstring filename = wpath.substr(wpath.find_last_of(L"\\") + 1);
        HANDLE event = CreateEvent(NULL, TRUE, FALSE, NULL);
        std::string out;
        std::string pathtmp = m_config["lrcsavepath"];
        if(pathtmp.at(pathtmp.length() - 1) != '\\')
            pathtmp += '\\';
        service_ptr_t<LRCTitleFormatCallback> p_callback = new service_impl_t<LRCTitleFormatCallback>(event, &out, pathtmp, track);
        static_api_ptr_t<main_thread_callback_manager>()->add_callback(p_callback);
        p_callback.release();
        WaitForSingleObject(event, INFINITE);
        CloseHandle(event);
        wpath = EncodingFunc::ToUTF16(out);
        if(PathIsRelative(wpath.c_str()))
            wpath = dirname + wpath;
        if(GetFileAttributes(wpath.c_str()) & FILE_ATTRIBUTE_DIRECTORY && (GetLastError() != ERROR_FILE_NOT_FOUND && GetLastError() != ERROR_PATH_NOT_FOUND))
            wpath += filename;
        return wpath;
    }

    if(path.find_first_of("file://") == std::string::npos)
        return std::wstring(L"");
    if(path.find_first_of("unpack://") == std::string::npos)
        return std::wstring(L"");
    return wpath;
}
开发者ID:dlunch,项目名称:foo_alsong_lyric,代码行数:57,代码来源:LyricSourceLRC.cpp


示例12: GetFullPath

CString CFilePatchesDlg::GetFullPath(int nIndex)
{
	CString temp = m_pPatch->GetStrippedPath(nIndex);
	temp.Replace('/', '\\');
	//temp = temp.Mid(temp.Find('\\')+1);
	if (PathIsRelative(temp))
		temp = m_sPath + temp;
	return temp;
}
开发者ID:3F,项目名称:tortoisegit-mdc,代码行数:9,代码来源:FilePatchesDlg.cpp


示例13: is_definite

int is_definite( const char * filename )
{
    #ifdef _UNIX_
    return (filename[0] == '/') || (filename[0] == '.');

    #else // Should we assume windows?!
    // Windows impl
    return (PathIsRelative( filename ) == FALSE) || (filename[0] == '.');
    #endif
}
开发者ID:beagleboard,项目名称:am335x_pru_package,代码行数:10,代码来源:path_utils.c


示例14: dl_open

static void*
dl_open(const char* name, int flags)
{
    if (name == NULL) {
        return GetModuleHandle(NULL);
    } else {
        DWORD dwFlags = PathIsRelative(name) ? 0 : LOAD_WITH_ALTERED_SEARCH_PATH;
        return LoadLibraryEx(name, NULL, dwFlags);
    }
}
开发者ID:jnr,项目名称:jffi,代码行数:10,代码来源:Library.c


示例15: _T

bool SubmoduleAddCommand::Execute()
{
	bool bRet = false;
	CSubmoduleAddDlg dlg;
	dlg.m_strPath = cmdLinePath.GetDirectory().GetWinPathString();
	dlg.m_strProject = g_Git.m_CurrentDir;
	if( dlg.DoModal() == IDOK )
	{
		if (dlg.m_bAutoloadPuttyKeyFile)
			CAppUtils::LaunchPAgent(&dlg.m_strPuttyKeyFile);

		CString cmd;
		if(dlg.m_strPath.Left(g_Git.m_CurrentDir.GetLength()) == g_Git.m_CurrentDir)
			dlg.m_strPath = dlg.m_strPath.Right(dlg.m_strPath.GetLength()-g_Git.m_CurrentDir.GetLength()-1);

		CString branch;
		if(dlg.m_bBranch)
			branch.Format(_T(" -b %s "), (LPCTSTR)dlg.m_strBranch);

		CString force;
		if (dlg.m_bForce)
			force = _T("--force");

		dlg.m_strPath.Replace(_T('\\'),_T('/'));
		dlg.m_strRepos.Replace(_T('\\'),_T('/'));

		cmd.Format(_T("git.exe submodule add %s %s -- \"%s\"  \"%s\""),
						(LPCTSTR)branch, (LPCTSTR)force,
						(LPCTSTR)dlg.m_strRepos, (LPCTSTR)dlg.m_strPath);

		CProgressDlg progress;
		progress.m_GitCmd=cmd;
		progress.DoModal();

		if (progress.m_GitStatus == 0)
		{
			if (dlg.m_bAutoloadPuttyKeyFile)
			{
				SetCurrentDirectory(g_Git.m_CurrentDir);
				CGit subgit;
				dlg.m_strPath.Replace(_T('/'), _T('\\'));
				subgit.m_CurrentDir = PathIsRelative(dlg.m_strPath) ? g_Git.CombinePath(dlg.m_strPath) : dlg.m_strPath;

				if (subgit.SetConfigValue(_T("remote.origin.puttykeyfile"), dlg.m_strPuttyKeyFile, CONFIG_LOCAL))
				{
					CMessageBox::Show(NULL, _T("Fail set config remote.origin.puttykeyfile"), _T("TortoiseGit"), MB_OK| MB_ICONERROR);
					return FALSE;
				}
			}
		}

		bRet = TRUE;
	}
	return bRet;
}
开发者ID:Teivaz,项目名称:TortoiseGit,代码行数:55,代码来源:SubmoduleCommand.cpp


示例16: fixRelativePaths

static void fixRelativePaths(strings &dirs, const char_t *basepath)
{
    for (strings::iterator d = dirs.begin(); d != dirs.end(); d++)
        if (PathIsRelative(d->c_str())) {
            char_t absdir[MAX_PATH];
            _makepath_s(absdir, countof(absdir), NULL, basepath, d->c_str(), NULL);
            char_t absdirC[MAX_PATH];
            PathCanonicalize(absdirC, absdir);
            *d = absdirC;
        }
}
开发者ID:TheRyuu,项目名称:ffdshow,代码行数:11,代码来源:TsubtitlesFile.cpp


示例17: sbncIsAbsolutePath

bool sbncIsAbsolutePath(const char *Path) {
#ifdef _WIN32
	return !PathIsRelative(Path);
#else
	if (Path[0] == '/') {
		return true;
	}

	return false;
#endif
}
开发者ID:demize,项目名称:shroudbnc,代码行数:11,代码来源:sbnc.cpp


示例18: osd_is_absolute_path

int osd_is_absolute_path(const char *path)
{
	int result = FALSE;
	TCHAR *t_path = tstring_from_utf8(path);
	if (t_path != NULL)
	{
		result = !PathIsRelative(t_path);
		free(t_path);
	}
	return result;
}
开发者ID:broftkd,项目名称:mess-cvs,代码行数:11,代码来源:windir.c


示例19: osd_is_absolute_path

bool osd_is_absolute_path(std::string const &path)
{
    bool result = false;
    TCHAR *t_path = tstring_from_utf8(path.c_str());
    if (t_path != nullptr)
    {
        result = !PathIsRelative(t_path);
        osd_free(t_path);
    }
    return result;
}
开发者ID:keshbach,项目名称:mame,代码行数:11,代码来源:winfile.cpp


示例20: Windows_pathIsRelative

static jboolean Windows_pathIsRelative(JNIEnv* env, jclass, jstring javaPath) {
    ScopedUtfChars path(env, javaPath);
    if (path.c_str() == NULL) {
        return false;
    }

    if (path.size() > MAX_PATH) {
    	return false;	// TODO: Possible throw an exception in this case...
    }

    return PathIsRelative(path.c_str());
}
开发者ID:bigfatbrowncat,项目名称:avian-pack.android.libcore,代码行数:12,代码来源:libcore_io_Windows.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PathJoin函数代码示例发布时间:2022-05-30
下一篇:
C++ PathFindFileName函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap