[Box Backup-commit] COMMIT r1265 - in box/chris/merge: bin/bbackupd lib/common
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Wed, 17 Jan 2007 21:59:13 +0000
Author: chris
Date: 2007-01-17 21:59:13 +0000 (Wed, 17 Jan 2007)
New Revision: 1265
Added:
box/chris/merge/lib/common/PathUtils.cpp
box/chris/merge/lib/common/PathUtils.h
Modified:
box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp
Log:
Moved MakeFullPath into its own library file so that we can share it
(BackupQueries needs it too) (refs #3)
Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp
===================================================================
--- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-01-17 20:42:44 UTC (rev 1264)
+++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-01-17 21:59:13 UTC (rev 1265)
@@ -29,6 +29,7 @@
#include "BackupDaemon.h"
#include "BackupStoreException.h"
#include "Archive.h"
+#include "PathUtils.h"
#include "MemLeakFindOn.h"
@@ -97,33 +98,6 @@
// --------------------------------------------------------------------------
//
// Function
-// Name: MakeFullPath(const std::string& rDir, const std::string& rFile)
-// Purpose: Combine directory and file name
-// Created: 2006/08/10
-//
-// --------------------------------------------------------------------------
-static std::string MakeFullPath(const std::string& rDir,
- const std::string& rFile)
-{
- std::string result;
-
- if (rDir.size() > 0 &&
- rDir[rDir.size()-1] == DIRECTORY_SEPARATOR_ASCHAR)
- {
- result = rDir + rFile;
- }
- else
- {
- result = rDir + DIRECTORY_SEPARATOR + rFile;
- }
-
- return result;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Function
// Name: BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::SyncParams &, int64_t, const std::string &, bool)
// Purpose: Syncronise, recusively, a local directory with the server.
// Created: 2003/10/08
Added: box/chris/merge/lib/common/PathUtils.cpp
===================================================================
--- box/chris/merge/lib/common/PathUtils.cpp (rev 0)
+++ box/chris/merge/lib/common/PathUtils.cpp 2007-01-17 21:59:13 UTC (rev 1265)
@@ -0,0 +1,34 @@
+// --------------------------------------------------------------------------
+//
+// File
+// Name: PathUtils.cpp
+// Purpose: Platform-independent path manipulation
+// Created: 2007/01/17
+//
+// --------------------------------------------------------------------------
+
+#include "Box.h"
+#include <string>
+
+// --------------------------------------------------------------------------
+//
+// Function
+// Name: MakeFullPath(const std::string& rDir, const std::string& rFile)
+// Purpose: Combine directory and file name
+// Created: 2006/08/10
+//
+// --------------------------------------------------------------------------
+std::string MakeFullPath(const std::string& rDir, const std::string& rEntry)
+{
+ std::string result(rDir);
+
+ if (result.size() > 0 &&
+ result[result.size()-1] != DIRECTORY_SEPARATOR_ASCHAR)
+ {
+ result += DIRECTORY_SEPARATOR;
+ }
+
+ result += rEntry;
+
+ return result;
+}
Added: box/chris/merge/lib/common/PathUtils.h
===================================================================
--- box/chris/merge/lib/common/PathUtils.h (rev 0)
+++ box/chris/merge/lib/common/PathUtils.h 2007-01-17 21:59:13 UTC (rev 1265)
@@ -0,0 +1,26 @@
+// --------------------------------------------------------------------------
+//
+// File
+// Name: PathUtils.h
+// Purpose: Platform-independent path manipulation
+// Created: 2007/01/17
+//
+// --------------------------------------------------------------------------
+
+#ifndef PATHUTILS_H
+#define PATHUTILS_H
+
+#include <string>
+
+// --------------------------------------------------------------------------
+//
+// Function
+// Name: MakeFullPath(const std::string& rDir, const std::string& rFile)
+// Purpose: Combine directory and file name
+// Created: 2006/08/10
+//
+// --------------------------------------------------------------------------
+
+std::string MakeFullPath(const std::string& rDir, const std::string& rEntry);
+
+#endif // !PATHUTILS_H