From: ThorstenB Date: Mon, 20 Jun 2011 20:46:46 +0000 (+0200) Subject: fix #353: svn doesn't like stray path separators X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cc0679983845866eecf08d68806d5ec18a2b1550;p=simgear.git fix #353: svn doesn't like stray path separators --- diff --git a/simgear/scene/tsync/terrasync.cxx b/simgear/scene/tsync/terrasync.cxx index d242dec6..9a35afce 100644 --- a/simgear/scene/tsync/terrasync.cxx +++ b/simgear/scene/tsync/terrasync.cxx @@ -95,6 +95,22 @@ const char* svn_options = typedef map CompletedTiles; +/////////////////////////////////////////////////////////////////////////////// +// helper functions /////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +string stripPath(string path) +{ + // svn doesn't like trailing white-spaces or path separators - strip them! + path = simgear::strutils::strip(path); + int slen = path.length(); + while ((slen>0)&& + (path[slen-1]=='/')||(path[slen-1]=='\\')) + { + slen--; + } + return path.substr(0,slen); +} + /////////////////////////////////////////////////////////////////////////////// // WaitingTile //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// @@ -125,10 +141,10 @@ public: bool hasNewTiles() { return !_freshTiles.empty();} WaitingTile getNewTile() { return _freshTiles.pop_front();} - void setSvnServer(string server) { _svn_server = simgear::strutils::strip(server);} + void setSvnServer(string server) { _svn_server = stripPath(server);} void setExtSvnUtility(string svn_util) { _svn_command = simgear::strutils::strip(svn_util);} void setRsyncServer(string server) { _rsync_server = simgear::strutils::strip(server);} - void setLocalDir(string dir) { _local_dir = simgear::strutils::strip(dir);} + void setLocalDir(string dir) { _local_dir = stripPath(dir);} string getLocalDir() { return _local_dir;} void setUseSvn(bool use_svn) { _use_svn = use_svn;}