This 'fix' does not give the right result on Linux (Ubuntu 9.10 GCC). The
original code was correct.
Does the win32 implementation of rfind() work differently ?
Peter
commit 20de4c4caeadb1dc94a108b254da72171ad3c327
Author: Jean Sreng <jean [dot] sreng [..] ...>
Date: Wed Jul 7 16:27:21 2010 +0200
plugins: get the right substring for shortname
diff --git a/rtt/plugin/PluginLoader.cpp b/rtt/plugin/PluginLoader.cpp
index e7bb633..98354f0 100644
--- a/rtt/plugin/PluginLoader.cpp
+++ b/rtt/plugin/PluginLoader.cpp
@@ -93,7 +93,7 @@ string makeShortFilename(string const& str) {
if (str.substr(0,3) == "lib")
ret = str.substr(3);
if (str.rfind(SO_EXT) != string::npos)
- ret = ret.substr(0, str.rfind(SO_EXT) - SO_EXT.length() );
+ ret = ret.substr(0, str.rfind(SO_EXT) );
return ret;
}
[win32] Bug in: plugins: get the right substring for shortname
Le 13/07/2010 14:43, Peter Soetens a écrit :
> This 'fix' does not give the right result on Linux (Ubuntu 9.10 GCC). The
> original code was correct.
>
> Does the win32 implementation of rfind() work differently ?
The implementation is not different. I think the good line is (note the
"ret" instead of "str" for the rfind):
ret = ret.substr(0, ret.rfind(SO_EXT) )
It worked on linux because len(".so") = len("lib")