Menu

[r18]: / src / pathresolver.cpp  Maximize  Restore  History

Download this file

40 lines (33 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <wx/filename.h>
#include "pathresolver.h"
wxString PathResolver::run(const wxString& path, const wxString& anchor)
{
if (path.empty())
return wxEmptyString;
wxString myPath, myAnchor;
myPath = path;
myAnchor = anchor;
wxFileName pathObject(myPath);
if (pathObject.IsAbsolute() ||
myPath.Contains(_T("http://")))
return myPath;
// check anchor
wxFileName anchorObject(myAnchor);
if (myAnchor.empty()) { myAnchor = wxFileName::GetCwd(); }
else if (!anchorObject.IsDir())
{
myAnchor = anchorObject.GetPath();
}
pathObject.MakeAbsolute(myAnchor);
return pathObject.GetFullPath();
}
std::string PathResolver::run(
const std::string& path,
const std::string& anchor)
{
wxString widePath, wideAnchor;
widePath = wxString(path.c_str(), wxConvUTF8, path.size());
wideAnchor = wxString(anchor.c_str(), wxConvUTF8, anchor.size());
wxString wideReturn = PathResolver::run(widePath, wideAnchor);
return (const char *)wideReturn.mb_str(wxConvUTF8);
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.