Improved support for loading files, and support for file drop

This commit is contained in:
brunoherbelin
2020-05-12 21:27:21 +02:00
parent 5771196515
commit 0e1cbd33f2
6 changed files with 38 additions and 25 deletions

View File

@@ -70,22 +70,13 @@ std::string SystemToolkit::base_filename(const std::string& filename)
std::string SystemToolkit::path_filename(const std::string& filename)
{
std::string path = filename.substr(0, filename.find_last_of(PATH_SEP) + 1);
return path;
}
// TODO : for windows path C:\gstreamer\1.0\x86\bin\pima.mp3 <=> file:///C:/gstreamer/1.0/x86/bin/pima.mp3
std::string SystemToolkit::path_to_uri(const std::string& path)
std::string SystemToolkit::extension_filename(const std::string& filename)
{
std::string uri = "file://" + path;
return uri;
}
std::string SystemToolkit::uri_to_path(const std::string& uri)
{
// prefix "file://" of lenght 7
std::string path = uri.substr(7);
return path;
std::string ext = filename.substr(filename.find_last_of(".") + 1);
return ext;
}
std::string SystemToolkit::home_path()