If you have a cool piece of software to share, but you are not hosting it officially yet, please dump it in here. If you have code snippets that are useful, please donate!
-
eranon
- Can't get richer than this

- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
-
Contact:
Post
by eranon » Wed Jul 10, 2013 10:22 am
I've tried and it works well on my side (under Windows 7 Pro 64-bit FR edition) using this function (to be sure we talk about the same one) :
Code: Select all
bool IsSubDir(wxString strRefPath, wxString strPathToTest)
{
wxFileName fn(strPathToTest);
if (!fn.MakeRelativeTo(strRefPath))
return false;
if (fn.GetFullPath().Find("..") == 0)
return false;
return true;
}
Here are some test results :

- snap_0000194.png (12.88 KiB) Viewed 3079 times
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
-
evstevemd
- Part Of The Furniture

- Posts: 2293
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
-
Contact:
Post
by evstevemd » Wed Jul 10, 2013 10:29 am
eranon wrote:I've tried and it works well on my side (under Windows 7 Pro 64-bit FR edition) using this function (to be sure we talk about the same one) :
Code: Select all
bool IsSubDir(wxString strRefPath, wxString strPathToTest)
{
wxFileName fn(strPathToTest);
if (!fn.MakeRelativeTo(strRefPath))
return false;
if (fn.GetFullPath().Find("..") == 0)
return false;
return true;
}
Here are some test results :
snap_0000194.png
Well I will try it again may be something else was wrong than what I thought.
I use linux, Ubuntu to be specific!
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]
-
eranon
- Can't get richer than this

- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
-
Contact:
Post
by eranon » Wed Jul 10, 2013 10:50 am
Nothing urgent, but I think it would be nice if you could push the test (maybe related to MakeRelativeTo's underlying code against Linux), evstevemd. On my side, my dev. env. are currently only under Windows and OS X. I'm using Linux too (Ubuntu, Fedora and CentOS), but without any up and running dev environment and wxWidgets right now.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
-
evstevemd
- Part Of The Furniture

- Posts: 2293
- Joined: Wed Jan 28, 2009 11:57 am
- Location: United Republic of Tanzania
-
Contact:
Post
by evstevemd » Mon Aug 19, 2013 12:19 pm
Ah! I found that my code messed up the paths and so the code works fine!

Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]