diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-05-24 16:31:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-05-25 08:57:24 +0100 |
commit | 693d7797ac3b1080803f89758d008d2d4c3b175f (patch) | |
tree | 3f691138bd0403ec331174baaa19d74205a6ca75 /jvmfwk | |
parent | 3f0cbdfd3b794fe82c374b728eda4a35226c9341 (diff) |
use comphelper::resolveLink
Diffstat (limited to 'jvmfwk')
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/makefile.mk | 1 | ||||
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 41 | ||||
-rw-r--r-- | jvmfwk/prj/build.lst | 2 |
3 files changed, 16 insertions, 28 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk b/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk index 76fd7c973394..9640bf887a2e 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 8a32cb3f4133..6cbfb73ebfe0 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; } diff --git a/jvmfwk/prj/build.lst b/jvmfwk/prj/build.lst index bd09aae41774..1a8d67401648 100644 --- a/jvmfwk/prj/build.lst +++ b/jvmfwk/prj/build.lst @@ -1,4 +1,4 @@ -jvmf jvmfwk : cppu cppuhelper sal LIBXML2:libxml2 NULL +jvmf jvmfwk : cppu cppuhelper sal comphelper LIBXML2:libxml2 NULL jvmf jvmfwk\inc nmake - all jvmf_inc NULL jvmf jvmfwk\source nmake - all jvmf_framework jvmf_inc NULL jvmf jvmfwk\plugins\sunmajor\pluginlib nmake - all jvmf_sunmajorlib jvmf_inc NULL |