diff options
author | Keith Bostic <keith@wiredtiger.com> | 2014-10-09 09:37:47 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2014-10-09 09:37:47 -0400 |
commit | 7aa28061ae330592fe675656698ba31540c5964f (patch) | |
tree | 2ffa1cc2e99fc8329db6e5f068c7517317d43a18 /src/support/filename.c | |
parent | f4ba7cf136314b7c5c5fc14bc35e04db4c2588cb (diff) | |
download | mongo-7aa28061ae330592fe675656698ba31540c5964f.tar.gz |
Abstract out the "is it an absolute path" function, and the path
separator string. Add tests for drive names to the Windows version
of the absolute path function.
Diffstat (limited to 'src/support/filename.c')
-rw-r--r-- | src/support/filename.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/support/filename.c b/src/support/filename.c index e62df273ec0..bd5d03fa633 100644 --- a/src/support/filename.c +++ b/src/support/filename.c @@ -8,16 +8,6 @@ #include "wt_internal.h" /* - * __wt_absolute_path -- - * Return if a filename is an absolute path. - */ -int -__wt_absolute_path(const char *path) -{ - return (path[0] == '/' ? 1 : 0); -} - -/* * __wt_filename -- * Build a file name in a scratch buffer, automatically calculate the * length of the file name. @@ -50,11 +40,8 @@ __wt_nfilename( else { len = strlen(conn->home) + 1 + namelen + 1; WT_RET(__wt_calloc(session, 1, len, &buf)); -#ifdef _WIN32 - snprintf(buf, len, "%s\\%.*s", conn->home, (int)namelen, name); -#else - snprintf(buf, len, "%s/%.*s", conn->home, (int)namelen, name); -#endif + snprintf(buf, len, "%s%s%.*s", + conn->home, __wt_path_separator(), (int)namelen, name); *path = buf; } |