This is overly complicated. Following will do:

````
CStdString file = strPath;
URIUtils::AddSlashAtEnd(strPath);
CURL url(file);
````