On 28/07/2017 at 22:47, xxxxxxxx wrote:
Cinema 4D Version: R17, R18
Platform: Windows ;
Language(s) : C++ ;
Until now I have only needed to access files in my Python plugins, and didn't encounter an issue then.
In C++, however, it seems there's something odd. And as I guess this is a very basic feature used by a large number of plugins (?), it would have been brought up earlier. Since I couldn't find anything related, and as assumed this is a frequently used feature, I suppose this is not a bug but a user error ... hence the reason I 'm bringing this up here and not in the bug report part of the forum.
So, please, educate me. What am I doing wrong?
// step 1. get the plugin path, and append subfolder and filename Filename path = GeGetPluginPath(); path += "//subfolder"; path += "//filename.txt"; // appending seem to have no effect, as "path" still only contains // the original plugin path // step 2. get the plugin path as a string and append subfolder and filename as strings String pathStr = GeGetPluginPath().GetString(); pathStr += "\\subfolder"; pathStr += "\\filename.txt"; // appending is successful, now get it into a Filename path.SetString(pathStr); // bingo !!! // step 3. String subfolder = "subfolder"; String filename = "filename"; Filename fullPath = GeGetPluginPath() + "//" + subfolder + "//" + filename + ".txt"; // -> results in "C:/Users/.../plugins/pluginname/subfolder/filename/.txt" // why the extra / between filename and .txt ???
Why does step 1 not work?
Why do I need to construct a path via String as shown in step 2. This works on Windows, but does it also work on MacOS?
And why do I get that weird result in step 3
Thanks in advance.