Page MenuHomePhabricator

Unify PlatformPOSIX::ResolveExecutable

Authored by labath on Feb 1 2017, 10:48 AM.



various platforms very using nearly identical code for this method. As far as I
can tell there was nothing platform-specific about the differences, but rather
it looked like it was caused by tiny tweaks being made to individual copies
without affecting the overall functionality. I have taken the superset of all
these tweaks and put it into one method in the base class (incidentaly, nobody
was using the base class implementation of the method, as all classes were
overriding it). From the darwin class I took the slightly improved error
reporting (checking whether the file is readable) and the
ResolveExecutableInBundle call (which has no effect elsewhere as the function
is already a no-op on non-darwin platforms). From the linux class I took the
set-the-triple-vendor-to-host-if-unspecified tweak (present in PlatformKalimba
as well).

PlatformWindows has an identical copy as well. We could resolve that by pushing
this code further down into Platform class, that that would require pushing the
m_remote_platform_sp member as well, which seems like a bad design choice.

Diff Detail


Event Timeline

labath created this revision.Feb 1 2017, 10:48 AM
labath added inline comments.Feb 1 2017, 10:50 AM
163 ↗(On Diff #86672)

This is the bit that was only present on darwin.

198 ↗(On Diff #86672)

This is the bit that was only present on linux.

krytarowski edited edge metadata.Feb 1 2017, 11:12 AM

It looks good.

krytarowski accepted this revision.Feb 1 2017, 12:33 PM
This revision is now accepted and ready to land.Feb 1 2017, 12:33 PM
clayborg accepted this revision.Feb 1 2017, 2:22 PM
This revision was automatically updated to reflect the committed changes.