diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-04-12 21:29:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-04-12 21:29:27 +0100 |
commit | 2d954b614956c70d02761060dbb465d809c74fc0 (patch) | |
tree | aa82dcb56baf6f0a8d1a5dbd3987feb8c80a8b34 /desktop/source/deployment/misc | |
parent | d283eadbc5b82ced160017b0870192305fb70e71 (diff) |
Resolves: #i113273# use modification time of soft link targets if linked
Diffstat (limited to 'desktop/source/deployment/misc')
-rw-r--r-- | desktop/source/deployment/misc/dp_misc.cxx | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 1a46cdda3d5a..67b459ac847a 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -142,6 +142,23 @@ bool existsOfficePipe() return pipe.is(); } +//get modification time +static bool getModifyTimeTargetFile(const OUString &rFileURL, TimeValue &rTime) +{ + ::osl::DirectoryItem item; + if (::osl::DirectoryItem::get(rFileURL, item) != ::osl::File::E_None) + return false; + + ::osl::FileStatus stat(FileStatusMask_ModifyTime|FileStatusMask_Type|FileStatusMask_LinkTargetURL); + if (item.getFileStatus(stat) != ::osl::File::E_None) + return false; + + if( stat.getFileType() == ::osl::FileStatus::Link ) + return getModifyTimeTargetFile(stat.getLinkTargetURL(), rTime); + + rTime = stat.getModifyTime(); + return true; +} //Returns true if the Folder was more recently modified then //the lastsynchronized file. That is the repository needs to @@ -180,15 +197,12 @@ bool compareExtensionFolderWithLastSynchronizedFile( //compare the modification time of the extension folder and the last //modified file - ::osl::FileStatus statFolder(FileStatusMask_ModifyTime); - ::osl::FileStatus statFile(FileStatusMask_ModifyTime); - if (itemExtFolder.getFileStatus(statFolder) == ::osl::File::E_None) + TimeValue timeFolder; + if (getModifyTimeTargetFile(folderURL, timeFolder)) { - if (itemFile.getFileStatus(statFile) == ::osl::File::E_None) + TimeValue timeFile; + if (getModifyTimeTargetFile(fileURL, timeFile)) { - TimeValue timeFolder = statFolder.getModifyTime(); - TimeValue timeFile = statFile.getModifyTime(); - if (timeFile.Seconds < timeFolder.Seconds) bNeedsSync = true; } @@ -203,6 +217,7 @@ bool compareExtensionFolderWithLastSynchronizedFile( OSL_ASSERT(0); bNeedsSync = true; } + return bNeedsSync; } |