summaryrefslogtreecommitdiff
path: root/jvmfwk/plugins
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-05-24 16:31:38 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-05-25 08:57:24 +0100
commit70d661eb82aad0be5cb3925c4251fa3099b11253 (patch)
tree39b9aae349446844aeb3c7bc81696f075aad7200 /jvmfwk/plugins
parentb6a9ee9e13f6306bab4c8a23e2331bb6cbc3807b (diff)
use comphelper::resolveLink
Diffstat (limited to 'jvmfwk/plugins')
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/makefile.mk1
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/util.cxx41
2 files changed, 15 insertions, 27 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk b/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk
index 76fd7c973..9640bf887 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk
+++ b/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk
@@ -61,6 +61,7 @@ SHL1TARGET= $(UNOCOMPONENT1)
SHL1STDLIBS= \
$(CPPULIB) \
$(CPPUHELPER) \
+ $(COMPHELPERLIB) \
$(SALLIB) \
$(SALHELPERLIB)
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index 605dc27ba..83d919169 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -39,6 +39,7 @@
#include "rtl/byteseq.hxx"
#include "rtl/ustrbuf.hxx"
#include "rtl/instance.hxx"
+#include <comphelper/linkhelper.hxx>
#include "boost/scoped_array.hpp"
#include "com/sun/star/uno/Sequence.hxx"
#include <utility>
@@ -59,6 +60,7 @@
#include "sunjre.hxx"
#include "vendorlist.hxx"
#include "diagnostics.h"
+
using namespace osl;
using namespace std;
@@ -820,32 +822,20 @@ bool getJREInfoByPath(const rtl::OUString& path,
*/
OUString resolveDirPath(const OUString & path)
{
- OUString ret;
- OUString sResolved;
- //getAbsoluteFileURL also resolves links
- if (File::getAbsoluteFileURL(
- OUSTR("file:///"), path, sResolved) != File::E_None)
+ OUString sResolved = path;
+
+ if (!comphelper::resolveLink(sResolved))
return OUString();
- //check if this is a valid path and if it is a directory
+ OUString ret;
+
+ //check if this is a directory
DirectoryItem item;
if (DirectoryItem::get(sResolved, item) == File::E_None)
{
FileStatus status(osl_FileStatus_Mask_Type |
- osl_FileStatus_Mask_LinkTargetURL |
osl_FileStatus_Mask_FileURL);
- int nDepth = 0;
- while (item.getFileStatus(status) == File::E_None &&
- status.getFileType() == FileStatus::Link)
- {
- if (++nDepth == 128)
- break;
- sResolved = status.getLinkTargetURL();
- if (DirectoryItem::get(sResolved, item) != File::E_None)
- break;
- }
-
if (item.getFileStatus(status) == File::E_None
&& status.getFileType() == FileStatus::Directory)
{
@@ -856,8 +846,7 @@ OUString resolveDirPath(const OUString & path)
#endif
}
}
- else
- return OUString();
+
return ret;
}
/** Checks if the path is a file. If it is a link to a file than
@@ -865,20 +854,20 @@ OUString resolveDirPath(const OUString & path)
*/
OUString resolveFilePath(const OUString & path)
{
- OUString ret;
- OUString sResolved;
+ OUString sResolved = path;
- if (File::getAbsoluteFileURL(
- OUSTR("file:///"), path, sResolved) != File::E_None)
+ if (!comphelper::resolveLink(sResolved))
return OUString();
+ OUString ret;
+
//check if this is a valid path to a file or and if it is a link
DirectoryItem item;
if (DirectoryItem::get(sResolved, item) == File::E_None)
{
FileStatus status(osl_FileStatus_Mask_Type |
- osl_FileStatus_Mask_LinkTargetURL |
osl_FileStatus_Mask_FileURL);
+
if (item.getFileStatus(status) == File::E_None
&& status.getFileType() == FileStatus::Regular)
{
@@ -889,8 +878,6 @@ OUString resolveFilePath(const OUString & path)
#endif
}
}
- else
- return OUString();
return ret;
}