Add backslash as path separator for Win32.

llvm-svn: 191115
This commit is contained in:
Virgile Bello 2013-09-20 22:31:10 +00:00
parent 3036a8517f
commit 1fd7ec75fc
1 changed files with 10 additions and 1 deletions

View File

@ -328,7 +328,11 @@ FileSpec::SetFile (const char *pathname, bool resolve)
// Truncate the basename off the end of the resolved path
// Only attempt to get the dirname if it looks like we have a path
if (strchr(resolved_path, '/'))
if (strchr(resolved_path, '/')
#ifdef _WIN32
|| strchr(resolved_path, '\\')
#endif
)
{
char *directory = ::dirname (resolved_path);
@ -339,6 +343,11 @@ FileSpec::SetFile (const char *pathname, bool resolve)
else
{
char *last_resolved_path_slash = strrchr(resolved_path, '/');
#ifdef _WIN32
char* last_resolved_path_slash_windows = strrchr(resolved_path, '\\');
if (last_resolved_path_slash_windows > last_resolved_path_slash)
last_resolved_path_slash = last_resolved_path_slash_windows;
#endif
if (last_resolved_path_slash)
{
*last_resolved_path_slash = '\0';