summaryrefslogtreecommitdiff
path: root/registry/tools/regcompare.cxx
diff options
context:
space:
mode:
authorJuergen Schmidt <jsc@openoffice.org>2001-08-17 12:09:50 +0000
committerJuergen Schmidt <jsc@openoffice.org>2001-08-17 12:09:50 +0000
commita87e0923371a1821bc3bdb37515e15d831a4b113 (patch)
tree66af42686e353cb2d05ef73a3d3a320f1c949835 /registry/tools/regcompare.cxx
parent4aee767252a8e145a5ac78654ecc01cc9bb2986d (diff)
#91088# convert registry path to URL
Diffstat (limited to 'registry/tools/regcompare.cxx')
-rw-r--r--registry/tools/regcompare.cxx57
1 files changed, 53 insertions, 4 deletions
diff --git a/registry/tools/regcompare.cxx b/registry/tools/regcompare.cxx
index aacecfd7bbc3..72f620772d23 100644
--- a/registry/tools/regcompare.cxx
+++ b/registry/tools/regcompare.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: regcompare.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: pl $ $Date: 2001-05-10 10:47:10 $
+ * last change: $Author: jsc $ $Date: 2001-08-17 13:05:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,7 +77,56 @@
#include <rtl/alloc.h>
#endif
+#ifndef _OSL_PROCESS_H_
+#include <osl/process.h>
+#endif
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _OSL_THREAD_H_
+#include <osl/thread.h>
+#endif
+#ifndef _OSL_FILE_HXX_
+#include <osl/file.hxx>
+#endif
+
+#ifdef SAL_UNX
+#define SEPARATOR '/'
+#else
+#define SEPARATOR '\\'
+#endif
+
using namespace ::rtl;
+using namespace ::osl;
+
+sal_Bool isFileUrl(const OString& fileName)
+{
+ if (fileName.indexOf("file://") == 0 )
+ return sal_True;
+ return sal_False;
+}
+
+OUString convertToFileUrl(const OString& fileName)
+{
+ if ( isFileUrl(fileName) )
+ {
+ return OStringToOUString(fileName, osl_getThreadTextEncoding());
+ }
+
+ OUString uUrlFileName;
+ OUString uFileName(fileName.getStr(), fileName.getLength(), osl_getThreadTextEncoding());
+ if ( fileName.indexOf('.') == 0 || fileName.indexOf(SEPARATOR) < 0 )
+ {
+ OUString uWorkingDir;
+ OSL_VERIFY( osl_getProcessWorkingDir(&uWorkingDir.pData) == osl_Process_E_None );
+ OSL_VERIFY( FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uUrlFileName) == FileBase::E_None );
+ } else
+ {
+ OSL_VERIFY( FileBase::getFileURLFromSystemPath(uFileName, uUrlFileName) == FileBase::E_None );
+ }
+
+ return uUrlFileName;
+}
#define U2S( s ) \
OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr()
@@ -1821,8 +1870,8 @@ void _cdecl main( int argc, char * argv[] )
exit(1);
}
- OUString regName1( S2U(options.getRegName1()) );
- OUString regName2( S2U(options.getRegName2()) );
+ OUString regName1( convertToFileUrl(options.getRegName1()) );
+ OUString regName2( convertToFileUrl(options.getRegName2()) );
RegistryLoader regLoader;
Registry reg1(regLoader);