Kaydet (Commit) a53b9bb3 authored tarafından Caolán McNamara's avatar Caolán McNamara

tidy tools::getProcessWorkingDir

üst d8fb26b8
......@@ -39,10 +39,10 @@ namespace tools {
// get the process's current working directory, taking OOO_CWD into account
//
// @param url
// a non-null pointer that receives the directory URL (with or without a final
// slash) upon successful return, and the empty string upon unsuccessful return
TOOLS_DLLPUBLIC bool getProcessWorkingDir(rtl::OUString * url);
// @param rUrl
// Receives the directory URL (with or without a final slash) upon successful
// return, and the empty string upon unsuccessful return
TOOLS_DLLPUBLIC bool getProcessWorkingDir(rtl::OUString& rUrl);
}
......
......@@ -41,24 +41,27 @@
namespace tools {
bool getProcessWorkingDir(rtl::OUString * url) {
OSL_ASSERT(url != NULL);
bool getProcessWorkingDir(rtl::OUString &rUrl)
{
rUrl = rtl::OUString();
rtl::OUString s(RTL_CONSTASCII_USTRINGPARAM("$OOO_CWD"));
rtl::Bootstrap::expandMacros(s);
if (s.getLength() == 0) {
if (osl_getProcessWorkingDir(&url->pData) == osl_Process_E_None) {
if (s.getLength() == 0)
{
if (osl_getProcessWorkingDir(&rUrl.pData) == osl_Process_E_None)
return true;
}
} else if (s[0] == '1') {
*url = s.copy(1);
}
else if (s[0] == '1')
{
rUrl = s.copy(1);
return true;
} else if (s[0] == '2' &&
(osl::FileBase::getFileURLFromSystemPath(s.copy(1), *url) ==
}
else if (s[0] == '2' &&
(osl::FileBase::getFileURLFromSystemPath(s.copy(1), rUrl) ==
osl::FileBase::E_None))
{
return true;
}
*url = rtl::OUString();
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment