From b3eb79726a9b3c828c31242f8169cb55683c5018 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Fri, 4 Feb 2011 14:45:13 +0000 Subject: [PATCH] [dstore] leading file.searator in DSTORE_LOG_DIRECTORY not handled --- .../org/eclipse/dstore/core/model/DataStore.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java index 6d8c0892092..f2724af576d 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2010 IBM Corporation and others. + * Copyright (c) 2002, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -34,6 +34,7 @@ * David McKnight (IBM) - [289891] [dstore] StringIndexOutOfBoundsException in getUserPreferencesDirectory when DSTORE_LOG_DIRECTORY is "" * David McKnight (IBM) - [294933] [dstore] RSE goes into loop * David McKnight (IBM) - [331922] [dstore] enable DataElement recycling + * David McKnight (IBM) - [336257] [dstore] leading file.searator in DSTORE_LOG_DIRECTORY not handled *******************************************************************************/ package org.eclipse.dstore.core.model; @@ -3611,14 +3612,22 @@ public final class DataStore if (logDirectory == null){ logDirectory = ".eclipse" + File.separator + "RSE" + File.separator; //$NON-NLS-1$//$NON-NLS-2$ } - // append a '/' if not there + if (logDirectory.length() > 0){ + // append a '/' if not there if (logDirectory.charAt( logDirectory.length() -1 ) != File.separatorChar ) { logDirectory = logDirectory + File.separator; } + + // remove the '/' if first char + if (logDirectory.charAt(0) == File.separatorChar){ + logDirectory = logDirectory.substring(1); + } } - _userPreferencesDirectory = _userPreferencesDirectory + logDirectory + clientUserID; + _userPreferencesDirectory = _userPreferencesDirectory + logDirectory + clientUserID; + System.out.println("pref dir ="+_userPreferencesDirectory); + System.out.println("log dir="+logDirectory); File dirFile = new File(_userPreferencesDirectory); if (!dirFile.exists()) {