summaryrefslogtreecommitdiff
path: root/jvmfwk
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2004-05-05 09:14:01 +0000
committerJoachim Lingner <jl@openoffice.org>2004-05-05 09:14:01 +0000
commitde6af143cc13b0869e4a1bac236dde2b0b65abb2 (patch)
tree5a638b14096d61a4f65b2b9c1ee22dfa98c57a89 /jvmfwk
parent5c9f658f138b328845bdd0d5e4f9cefe3a7a4737 (diff)
#i20052#
Diffstat (limited to 'jvmfwk')
-rw-r--r--jvmfwk/source/elements.cxx43
-rw-r--r--jvmfwk/source/elements.hxx11
2 files changed, 49 insertions, 5 deletions
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 64d3edde0e93..fafe406258f2 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: elements.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: jl $ $Date: 2004-04-27 15:22:14 $
+ * last change: $Author: jl $ $Date: 2004-05-05 10:14:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,10 +68,12 @@
#include "libxml/parser.h"
#include "libxml/xpath.h"
#include "libxml/xpathInternals.h"
-
+#include "rtl/bootstrap.hxx"
// #define NS_JAVA_FRAMEWORK "http://openoffice.org/2004/java/framework/1.0"
// #define NS_SCHEMA_INSTANCE "http://www.w3.org/2001/XMLSchema-instance"
+
+using namespace osl;
namespace jfw
{
@@ -118,9 +120,44 @@ javaFrameworkError getElementUpdated(rtl::OString & sValue)
return errcode;
}
+bool createUserDirectory()
+{
+ bool ret = false;
+
+ rtl::OUString sUserDir;
+ rtl::Bootstrap::get(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UserInstallation")),
+ sUserDir,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "${$SYSBINDIR/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}")));
+
+ FileBase::RC rc = Directory::create(sUserDir);
+ if (rc == FileBase::E_None)
+ {
+ // .StarOfficeXXX file created in home directory
+ sUserDir += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/user"));
+ FileBase::RC rc = Directory::create(sUserDir);
+ if (rc == FileBase::E_None)
+ {
+ sUserDir += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/config"));
+ FileBase::RC rc = Directory::create(sUserDir);
+ if (rc == FileBase::E_None)
+ ret = true;
+ }
+ }
+ else if (rc == FileBase::E_EXIST)
+ {
+ ret = true;
+ }
+ // if the folder exists then all subdirectories should exist as well
+ return ret;
+}
javaFrameworkError createUserSettingsDocument()
{
+ //make sure there is a user directory
+ if( ! createUserDirectory())
+ return JFW_E_ERROR;
javaFrameworkError ret = JFW_E_NONE;
// check if javasettings.xml already exist
rtl::OUString sURL = getUserSettingsURL();
diff --git a/jvmfwk/source/elements.hxx b/jvmfwk/source/elements.hxx
index 403e3b51e6b0..9a626491d2e6 100644
--- a/jvmfwk/source/elements.hxx
+++ b/jvmfwk/source/elements.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: elements.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jl $ $Date: 2004-04-26 11:20:33 $
+ * last change: $Author: jl $ $Date: 2004-05-05 10:14:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,6 +79,13 @@ xmlNode* findChildNode(const xmlNode * pParent, const xmlChar* pName);
*/
javaFrameworkError getElementUpdated(rtl::OString & sValue);
+/** creates the user directory, if it does not exist already.
+
+ This is necessary, for tools, such as javaldx, run the java
+ configuration when the office is started for the first time.
+ Then the user directory may not be present yet.
+ */
+bool createUserDirectory();
/** creates the javasettings.xml in the users home directory.
If javasettings.xml does not exist then it creates the file