summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorAndreas Bregas <ab@openoffice.org>2000-12-13 15:30:21 +0000
committerAndreas Bregas <ab@openoffice.org>2000-12-13 15:30:21 +0000
commitcd8e0794ba18b451d6530eadfdd5a2586813b633 (patch)
treed85f7179cb37ae93384bdbe702f230e18b680759 /basic
parent2bc27b1e6e13ffeb0ebb7e8dc3c2ea425939acf1 (diff)
#80204# Test first if file names are already file URLs
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/methods.cxx37
1 files changed, 28 insertions, 9 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index dc7090b1c801..241ca323be7a 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: methods.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: ab $ $Date: 2000-12-08 16:35:54 $
+ * last change: $Author: ab $ $Date: 2000-12-13 16:30:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -241,12 +241,20 @@ static long GetDayDiff( const Date& rDate )
// according to the setting done by ChDir/ChDrive
String getFullPath( const String& aRelPath )
{
- //return aRelPath;
-
- String aUNCStr = getFullPathUNC( aRelPath );
-
OUString aFileURL;
- FileBase::RC nRet = File::getFileURLFromNormalizedPath( aUNCStr, aFileURL );
+
+ // #80204 Try first if it already is a file URL
+ INetURLObject aURLObj( aRelPath );
+ if( aURLObj.GetProtocol() == INET_PROT_FILE )
+ {
+ aFileURL = aURLObj.GetMainURL();
+ }
+ else
+ {
+ OUString aUNCStr;
+ FileBase::RC nRet = File::normalizePath( aRelPath, aUNCStr );
+ nRet = File::getFileURLFromNormalizedPath( aUNCStr, aFileURL );
+ }
return aFileURL;
}
@@ -255,13 +263,24 @@ String getFullPath( const String& aRelPath )
// according to the setting done by ChDir/ChDrive
String getFullPathUNC( const String& aRelPath )
{
+ OUString aNormPath;
+
// TODO: Use CurDir to build full path
// First step: Return given path unchanged
//static inline RC getAbsolutePath( const ::rtl::OUString& strDirBase, const ::rtl::OUString& strRelative, ::rtl::OUString& strAbsolute )
- OUString aNormPath;
- FileBase::RC nRet = File::normalizePath( aRelPath, aNormPath );
+ // #80204 Try first if it already is a file URL
+ INetURLObject aURLObj( aRelPath );
+ if( aURLObj.GetProtocol() == INET_PROT_FILE )
+ {
+ OUString aFileURL = aURLObj.GetMainURL();
+ FileBase::RC nRet = File::getNormalizedPathFromFileURL( aFileURL, aNormPath );
+ }
+ else
+ {
+ FileBase::RC nRet = File::normalizePath( aRelPath, aNormPath );
+ }
return aNormPath;
}