va_list arguments;
UnicodeIndex index;
- ASSERT(pathName);
- ASSERT(newExtension);
+ ASSERT(pathName != NULL);
+ ASSERT(newExtension != NULL);
ASSERT(*newExtension == '.');
File_GetPathName(pathName, &path, &base);
}
if (Unicode_IsEmpty(path)) {
- result = Unicode_Append(base, newExtension);
+ /*
+ * The pathName may be for a file in the CWD (e.g. "file.txt") or it
+ * could be in the POSIX root directory (e.g. "/file.txt").
+ */
+
+ if (File_IsFullPath(pathName)) {
+ result = Unicode_Join(DIRSEPS, base, newExtension, NULL);
+ } else {
+ result = Unicode_Append(base, newExtension);
+ }
} else {
result = Unicode_Join(path, DIRSEPS, base, newExtension, NULL);
}