[openjk] 17/130: Implement method rename
Simon McVittie
smcv at debian.org
Fri Oct 28 11:09:12 UTC 2016
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository openjk.
commit 6e49a952dc1ab27964b275b1ee9a1f3ca73499ba
Author: bibendovsky <bibendovsky at NOSTROMO>
Date: Sun Jul 3 23:34:08 2016 +0300
Implement method rename
---
shared/qcommon/ojk_sg_archive.cpp | 21 +++++++++++++++++----
shared/qcommon/ojk_sg_archive_fwd.h | 4 ++--
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/shared/qcommon/ojk_sg_archive.cpp b/shared/qcommon/ojk_sg_archive.cpp
index b65a84f..6e33274 100644
--- a/shared/qcommon/ojk_sg_archive.cpp
+++ b/shared/qcommon/ojk_sg_archive.cpp
@@ -132,11 +132,24 @@ void Archive::write_chunk(
}
void Archive::rename(
- const std::string& old_file_path,
- const std::string& new_file_path)
+ const std::string& old_base_file_name,
+ const std::string& new_base_file_name)
{
- throw ArchiveException(
- "Not implemented.");
+ auto old_path = generate_path(
+ old_base_file_name);
+
+ auto new_path = generate_path(
+ new_base_file_name);
+
+ auto rename_result = ::FS_MoveUserGenFile(
+ old_path.c_str(),
+ new_path.c_str());
+
+ if (rename_result != 0) {
+ ::Com_Printf(
+ S_COLOR_RED "Error during savegame-rename. Check \"%s\" for write-protect or disk full!\n",
+ new_path.c_str());
+ }
}
void Archive::remove(
diff --git a/shared/qcommon/ojk_sg_archive_fwd.h b/shared/qcommon/ojk_sg_archive_fwd.h
index 98fe193..574bb63 100644
--- a/shared/qcommon/ojk_sg_archive_fwd.h
+++ b/shared/qcommon/ojk_sg_archive_fwd.h
@@ -113,8 +113,8 @@ public:
// Renames a saved game file.
static void rename(
- const std::string& old_file_path,
- const std::string& new_file_path);
+ const std::string& old_base_file_name,
+ const std::string& new_base_file_name);
// Remove a saved game file.
static void remove(
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git
More information about the Pkg-games-commits
mailing list