currently there's no way to perform cross-platform operations.<div><br><div>what about:</div><div>---</div><div>enum Platform{Posix,Windows}</div><div>version(Posix) enum PlatformDefault=Platform.Posix; else enum PlatformDefault=Platform.Windows;</div>
<div>struct Path(T=PlatformDefault){}</div><div><br></div><div>void main(){</div><div>Path!(Platform.Posix) path="a\b";</div><div>auto path2=<a href="http://path.to">path.to</a>!Path;</div><div>}</div><div><div>
---</div></div><div><br></div><div>it allows current usage with no modification, and allows cross-platform logic.</div><div><br></div><div><br><div class="gmail_quote">On Wed, Jun 5, 2013 at 1:19 PM, Dylan Knutson <span dir="ltr"><<a href="mailto:tcdknutson@gmail.com" target="_blank">tcdknutson@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I don't have a strong opinion regarding Path object vs. string functions, and I agree both have advantages and disadvantages. But I would be opposed to having both.<br>
</blockquote>
<br></div>
Personally, I'd prefer to just use the Path struct in std.path. While a Path can be represented as a string, it's not the same concept (the same way that a DateTime can be represented as an integer, but we don't just pass times around as raw integer types).<br>

<br>
However, I can't imagine that'd be feasible as it'd break a lot of code. My suggestion would be to just keep the freestanding functions to operate on raw strings, and then migrate over code that depends on std.path to use the Path struct as needed. I realize that this is easier said than done, but even then it shouldn't be a lot of work as Path can implicitly be converted to a string.<br>

<br>
This makes its integration into existing codebases/Phobos literally as easy as using "Path my_path = `foo\bar`" instead of "string my_path = `foo\bar`". You lose no functionality but gain type safety if you have to do any future refactoring.<div class="im">
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 I wouldn't like to create an "object" just to call isAbsolute.<br>
</blockquote>
<br></div>
Agreed. The best course of action would probably be keep the raw functions as they exist (think of them as the static versions of Path methods). However, for large applications, the type safety of a Path object makes working with paths much easier.<br>

</blockquote></div><br></div></div>