relative path fix

This commit is contained in:
stax76
2022-08-05 07:11:50 +02:00
parent e2c720346a
commit a7fa76d63a
3 changed files with 14 additions and 9 deletions

View File

@@ -2,7 +2,7 @@
# 6.0.3.2 (2022-0?-??)
- Support multiple folders input (regression fix).
- Relative file input paths are internally converted to absolute paths.
- Relative file input paths are converted to absolute paths.
# 6.0.3.1 (2022-07-30)

View File

@@ -1210,11 +1210,7 @@ namespace mpvnet
if (file.Contains("|"))
file = file.Substring(0, file.IndexOf("|"));
if ((file.Contains(":/") && !file.Contains("://")) || (file.Contains(":\\") && file.Contains("/")))
file = file.Replace("/", "\\");
if (!file.Contains(":") && !file.StartsWith("\\\\") && File.Exists(file))
file = System.IO.Path.GetFullPath(file);
file = ConvertFilePath(file);
string ext = file.Ext();
@@ -1249,6 +1245,17 @@ namespace mpvnet
SetPropertyInt("playlist-pos", 0);
}
public string ConvertFilePath(string path)
{
if ((path.Contains(":/") && !path.Contains("://")) || (path.Contains(":\\") && path.Contains("/")))
path = path.Replace("/", "\\");
if (!path.Contains(":") && !path.StartsWith("\\\\") && File.Exists(path))
path = System.IO.Path.GetFullPath(path);
return path;
}
public void LoadISO(string path)
{
long gb = new FileInfo(path).Length / 1024 / 1024 / 1024;

View File

@@ -1,7 +1,6 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.Linq;
@@ -747,8 +746,7 @@ namespace mpvnet
string path = Core.GetPropertyString("path");
if ((path.Contains(":/") && !path.Contains("://")) || (path.Contains(":\\") && path.Contains("/")))
path = path.Replace("/", "\\");
path = Core.ConvertFilePath(path);
if (path.Contains("://"))
{