This is an archive of the discontinued LLVM Phabricator instance.

[Support, Windows] Handle long paths with unix separators
ClosedPublic

Authored by pirama on Aug 15 2017, 9:45 AM.

Details

Summary

The function widenPath() for Windows also normalizes long path names by
iterating over the path's components and calling append(). The
assumption during the iteration that separators are not returned by the
iterator doesn't hold because the iterators do return a separator when
the path has a drive name. Handle this case by ignoring separators
during iteration.

Event Timeline

pirama created this revision.Aug 15 2017, 9:45 AM
pirama updated this revision to Diff 111194.Aug 15 2017, 9:47 AM

Merged two calls to SmallString::append() in the test

rnk added inline comments.Aug 15 2017, 10:04 AM
unittests/Support/Path.cpp
702–703

The test process shouldn't create new directories in C:, or assume that C: exists. You can instead create the directory inside TestDirectory by calling fs::make_absolute on it and replacing all backslashes with slashes.

pirama updated this revision to Diff 111211.Aug 15 2017, 11:08 AM

Test under FileSystemTest's TestDirectory and cleanup.

rnk accepted this revision.Aug 21 2017, 10:50 AM

lgtm

This revision is now accepted and ready to land.Aug 21 2017, 10:50 AM
This revision was automatically updated to reflect the committed changes.

Committed. Thanks for the review.