[swift-evolution] [Pitch] Introducing #fileName debug identifier
Pyry Jahkola
pyry.jahkola at iki.fi
Mon Mar 14 06:20:51 CDT 2016
> On 14 Mar 2016, at 12:40, Radosław Pietruszewski via swift-evolution <swift-evolution at swift.org> wrote:
>
> Agreed. It’s really not useful for anyone to see `/Users/radex/Documents/Projects/MillionDollarAppIdea/` when logging errors or… anything really.
>
> I think a project-relative path should just be the new #file. I’m not even sure the full absolute path is necessary — but if it is, I’d rename it.
I think the biggest part of the problem is that Xcode has no option for building the project with relative file paths.
If file paths were relative (and `$PWD` were set to the project root—like it indeed is!) then `#file` would be the relative name. Actually, you can try it out, just give `swiftc` a roll yourself!
$ echo 'print(#file)' > foobar.swift
$ swiftc foobar.swift -o foobar && ./foobar
foobar.swift
$ swiftc "$PWD"/foobar.swift -o foobar && ./foobar
/Users/pyrtsa/foobar.swift
— Pyry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160314/f48b8eb3/attachment.html>
More information about the swift-evolution
mailing list