You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a continuation of my previous issue #15 - I wanted to keep the two items seperate because technically they are different issues.
If I provide (2) paths to IPurePath.Join() such as:
c:\someOther\directoryName\
\someFileName.exe
varpath=newMockPath(@"c:\ProgramFiles\");varjoined=path.Join(@"c:\someOther\directoryName\",@"\someFile.exe");// I can also provide these arguments and the same results as below will occur:varjoined=path.Join(@"c:\someOther\directoryName",@"\someFile.exe");
Exepected Result
Option 1: Be smart Note: This might have some issues with Unix systems and might not be a viable option. See Option 2 and 3.
Be smart and use the first rooted and (fully qualified) absolute path, then merge that with the rooted (relative) path | (This is for IPurePath)
Option 2: Be safe
^^ This gets a bit tricky with Unix Systems, so perhaps we throw an exception if (2) rooted paths are provided which are both fully qualified due to unix path formats it cannot be determined which is the relative path?
If two rooted paths are provided, we throw an exception | (This is for IPurePath)
Option 3: Be safe, and almost smart
If two rooted paths are provided, we throw an exception | (This is for IPurePath)
If two rooted paths are provided, but one of them has a 'drive' path (windows), we use that as the 'base fully qualified absolute path, then merge the other paths with it. | (This is for IPurePath)
Actual Result
The result will return c:\someFileName.exe
joined.ToString()==@"c:\someFile.exe";
My vote is for Option 3 as the method already tries to 'be smart' by appending the c: to the \someFileName.exe and makes that decision on its own.
Would love to know your thoughts! IMO we should be as cross platform friendly (safe) as possible
The text was updated successfully, but these errors were encountered:
I hope my comment in #15 mostly explain things, but I wanted to add one point here.
If two rooted paths are provided, we throw an exception
Given that Join supports a variable number of arguments (as does the constructor), I think it's important that each of the following produce the same results:
This is a continuation of my previous issue #15 - I wanted to keep the two items seperate because technically they are different issues.
If I provide (2) paths to
IPurePath.Join()
such as:c:\someOther\directoryName\
\someFileName.exe
Exepected Result
Option 1: Be smart
Note: This might have some issues with Unix systems and might not be a viable option. See Option 2 and 3.
Be smart and use the first rooted and (fully qualified) absolute path, then merge that with the rooted (relative) path | (This is for
IPurePath
)c:\someOther\directoryName\someFile.exe
Option 2: Be safe
^^ This gets a bit tricky with Unix Systems, so perhaps we throw an exception if (2) rooted paths are provided which are both fully qualified due to unix path formats it cannot be determined which is the relative path?
IPurePath
)Option 3: Be safe, and almost smart
IPurePath
)IPurePath
)Actual Result
The result will return
c:\someFileName.exe
My vote is for Option 3 as the method already tries to 'be smart' by appending the
c:
to the\someFileName.exe
and makes that decision on its own.Would love to know your thoughts! IMO we should be as cross platform friendly (safe) as possible
The text was updated successfully, but these errors were encountered: