summaryrefslogtreecommitdiff
path: root/registry/tools
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
parent4aee767252a8e145a5ac78654ecc01cc9bb2986d (diff)
#91088# convert registry path to URL
Diffstat (limited to 'registry/tools')
-rw-r--r--registry/tools/checksingleton.cxx57
-rw-r--r--registry/tools/regcompare.cxx57
-rw-r--r--registry/tools/regmerge.cxx59
-rw-r--r--registry/tools/regview.cxx60
4 files changed, 217 insertions, 16 deletions
diff --git a/registry/tools/checksingleton.cxx b/registry/tools/checksingleton.cxx
index 15255bb5d4d6..9f2e39de5f54 100644
--- a/registry/tools/checksingleton.cxx
+++ b/registry/tools/checksingleton.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: checksingleton.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jsc $ $Date: 2001-06-25 14:37:48 $
+ * 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()
@@ -392,8 +441,8 @@ void _cdecl main( int argc, char * argv[] )
exit(1);
}
- OUString indexRegName( S2U(options.getIndexReg()) );
- OUString typeRegName( S2U(options.getTypeReg()) );
+ OUString indexRegName( convertToFileUrl(options.getIndexReg()) );
+ OUString typeRegName( convertToFileUrl(options.getTypeReg()) );
RegistryLoader regLoader;
Registry indexReg(regLoader);
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);
diff --git a/registry/tools/regmerge.cxx b/registry/tools/regmerge.cxx
index 73f530dafceb..ae533bf077d7 100644
--- a/registry/tools/regmerge.cxx
+++ b/registry/tools/regmerge.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: regmerge.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+ * 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
@@ -72,6 +72,57 @@
#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;
+}
+
int realargc;
char* realargv[2048];
@@ -154,7 +205,7 @@ int _cdecl main( int argc, char * argv[] )
exit(1);
}
- ::rtl::OUString regName( ::rtl::OUString::createFromAscii(realargv[1]) );
+ ::rtl::OUString regName( convertToFileUrl(realargv[1]) );
if (reg_openRegistry(regName.pData, &hReg, REG_READWRITE))
{
if (reg_createRegistry(regName.pData, &hReg))
@@ -172,7 +223,7 @@ int _cdecl main( int argc, char * argv[] )
RegError _ret = REG_NO_ERROR;
for (int i = 3; i < realargc; i++)
{
- targetRegName = ::rtl::OUString::createFromAscii(realargv[i]);
+ targetRegName = convertToFileUrl(realargv[i]);
if (_ret = reg_mergeKey(hRootKey, mergeKeyName.pData, targetRegName.pData, sal_False, sal_True))
{
if (_ret == REG_MERGE_CONFLICT)
diff --git a/registry/tools/regview.cxx b/registry/tools/regview.cxx
index d488630f6180..61c872b88c20 100644
--- a/registry/tools/regview.cxx
+++ b/registry/tools/regview.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: regview.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+ * 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
@@ -71,6 +71,58 @@
#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;
+}
+
+
#if (defined UNX) || (defined OS2)
int main( int argc, char * argv[] )
#else
@@ -86,7 +138,7 @@ int _cdecl main( int argc, char * argv[] )
exit(1);
}
- ::rtl::OUString regName( ::rtl::OUString::createFromAscii(argv[1]) );
+ OUString regName( convertToFileUrl(argv[1]) );
if (reg_openRegistry(regName.pData, &hReg, REG_READONLY))
{
fprintf(stderr, "open registry \"%s\" failed\n", argv[1]);
@@ -97,7 +149,7 @@ int _cdecl main( int argc, char * argv[] )
{
if (argc == 3)
{
- ::rtl::OUString keyName( ::rtl::OUString::createFromAscii(argv[2]) );
+ OUString keyName( OUString::createFromAscii(argv[2]) );
if (!reg_openKey(hRootKey, keyName.pData, &hKey))
{
if (reg_dumpRegistry(hKey))