videotimeline: path related fixes for windows

This commit is contained in:
Robin Gareus 2014-04-19 02:03:43 +02:00
parent ce72458d09
commit 4fd1a5edd5
3 changed files with 13 additions and 8 deletions

View File

@ -313,6 +313,10 @@ AddVideoDialog::file_name (bool &local_file)
CURL *curl;
curl = curl_easy_init();
char *ue = curl_easy_unescape(curl, uri.c_str(), uri.length(), &plen);
#ifdef PLATFORM_WINDOWS
char *tmp;
while (tmp = strchr(ue, '/')) *tmp = '\\';
#endif
std::string path = video_get_docroot(Config) + ue;
if (!::access(path.c_str(), R_OK)) {
uri = path;

View File

@ -151,6 +151,13 @@ VideoUtils::video_map_path (std::string server_docroot, std::string filepath)
{
std::string rv = filepath;
/* strip docroot */
if (server_docroot.length() > 0) {
if (rv.compare(0, server_docroot.length(), server_docroot) == 0 ) {
rv = rv.substr(server_docroot.length());
}
}
/* replace all G_DIR_SEPARATOR with '/' */
size_t look_here = 0;
size_t found_here;
@ -159,13 +166,6 @@ VideoUtils::video_map_path (std::string server_docroot, std::string filepath)
look_here = found_here + 1;
}
/* strip docroot */
if (server_docroot.length() > 0) {
if (rv.compare(0, server_docroot.length(), server_docroot) == 0 ) {
rv = rv.substr(server_docroot.length());
}
}
CURL *curl;
char *ue;
curl = curl_easy_init();

View File

@ -452,7 +452,8 @@ VideoTimeLine::video_file_info (std::string filename, bool local)
{
local_file = local;
if (filename.at(0) == G_DIR_SEPARATOR || !local_file) {
if (Glib::path_is_absolute(filename) || !local_file)
{
video_filename = filename;
} else {
video_filename = Glib::build_filename (_session->session_directory().video_path(), filename);