|
|
@@ -1203,29 +1203,33 @@ void splitURL(const std::string& url, std::string* file, std::string* id)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // Check if the url references a file (otherwise, it only references a node within the main GPB).
|
|
|
- size_t loc = url.rfind(".");
|
|
|
+ // Check if the url references a file (otherwise, it only references some sort of ID)
|
|
|
+ size_t loc = url.rfind("#");
|
|
|
if (loc != std::string::npos)
|
|
|
{
|
|
|
- // If the url references a specific namespace within the file,
|
|
|
- // set the id out parameter appropriately. Otherwise, set the id out
|
|
|
- // parameter to the empty string so we know to load the first namespace.
|
|
|
- loc = url.rfind("#");
|
|
|
- if (loc != std::string::npos)
|
|
|
+ *file = url.substr(0, loc);
|
|
|
+ if (FileSystem::fileExists(file->c_str()))
|
|
|
{
|
|
|
- *file = url.substr(0, loc);
|
|
|
*id = url.substr(loc + 1);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- *file = url;
|
|
|
- *id = std::string();
|
|
|
+ *file = std::string();
|
|
|
+ *id = url;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- *file = std::string();
|
|
|
- *id = url;
|
|
|
+ if (FileSystem::fileExists(url.c_str()))
|
|
|
+ {
|
|
|
+ *file = url;
|
|
|
+ *id = std::string();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ *file = std::string();
|
|
|
+ *id = url;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|