Closed MrFly72 closed 1 year ago
Yes, I typically don't use relative paths so you're always gonna hit this problem in my modules. Probably all commands that take file path don't support it at the moment so that requires fixing. Care to PR?
PR? Pull request ? I am not a C# programmer at all at the moment I am more a powershell-scripter ;-) I was just curious as this is a non standard PS behaviour, as usually any tool taking a filepath can:
Current Workaround can be: eg: Get-ImageExif -file (Resolve-Path .\IMG_2179.jpg).Path Maybe there is a .net c# equivalent to that, which does the magic "by itself"?
It doesnt have to be added on c# level. Most of the commanda such as get-imagexif are standard powershell functions that just call c#. I guess one could fix it on c#. Its probably an easy fix.
Ye in c#
var currentDir = @"D:\toto\titi\tata\";
var case1 = Path.GetFullPath(Path.Combine(currentDir, @"test.txt"));
var case2 = Path.GetFullPath(Path.Combine(currentDir, @".\..\..\test\test.txt"));
var case3 = Path.GetFullPath(Path.Combine(currentDir, @".\..\test\test.txt"));
var case4 = Path.GetFullPath(Path.Combine(currentDir, @".\..\..\..\test\test.txt"));
var case5 = Path.GetFullPath(Path.Combine(currentDir, @".\..\..\..\..\test\test.txt"));
var case6 = Path.GetFullPath(Path.Combine(currentDir, @"\\server\share\folder\test".TrimStart('\\')));
So not hard, i'll fix it if there will be no takers. One can even use it in PowerShell [io.path]::GetFullPath(".\Test.ps1")
It seems that Get-ImageExif does not support relative paths and defaults then to the home directory of the user?
Translated: The File ..... cannot be found