/*
*******************************************************************************
*
-* Copyright (C) 1999-2010, International Business Machines
+* Copyright (C) 1999-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
#include <sys/stat.h>
#include "unicode/utypes.h"
-#ifdef U_WINDOWS
+#ifndef U_TOOLUTIL_IMPLEMENTATION
+#error U_TOOLUTIL_IMPLEMENTATION not set - must be set for all ICU source files in common/ - see http://userguide.icu-project.org/howtouseicu
+#endif
+
+#if U_PLATFORM_USES_ONLY_WIN32_API
# define VC_EXTRALEAN
# define WIN32_LEAN_AND_MEAN
# define NOUSER
#endif
/* In MinGW environment, io.h needs to be included for _mkdir() */
-#ifdef __MINGW32__
+#if U_PLATFORM == U_PF_MINGW
#include <io.h>
#endif
U_CAPI const char * U_EXPORT2
getLongPathname(const char *pathname) {
-#ifdef U_WINDOWS
+#if U_PLATFORM_USES_ONLY_WIN32_API
/* anticipate problems with "short" pathnames */
static WIN32_FIND_DATAA info;
HANDLE file=FindFirstFileA(pathname, &info);
}
#endif
if(!basename) {
- /* no basename - return '.'. */
- resultPtr = ".";
- resultLen = 1;
+ /* no basename - return ''. */
+ resultPtr = "";
+ resultLen = 0;
} else {
resultPtr = path;
resultLen = basename - path;
uprv_mkdir(const char *pathname, UErrorCode *status) {
int retVal = 0;
-#if defined(U_WINDOWS) || defined(__MINGW32__)
+#if U_PLATFORM_USES_ONLY_WIN32_API
retVal = _mkdir(pathname);
#else
retVal = mkdir(pathname, S_IRWXU | (S_IROTH | S_IXOTH) | (S_IROTH | S_IXOTH));
#endif
if (retVal && errno != EEXIST) {
-#if defined(U_CYGWIN)
- /*if using Cygwin and the mkdir says it failed...check if the directory already exists..*/
- /* if it does...don't give the error, if it does not...give the error - Brian Rower - 6/25/08 */
- struct stat st;
-
- if(stat(pathname,&st) != 0)
- {
- *status = U_FILE_ACCESS_ERROR;
- }
+#if U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
+ /*if using Cygwin and the mkdir says it failed...check if the directory already exists..*/
+ /* if it does...don't give the error, if it does not...give the error - Brian Rower - 6/25/08 */
+ struct stat st;
+
+ if(stat(pathname,&st) != 0)
+ {
+ *status = U_FILE_ACCESS_ERROR;
+ }
#else
*status = U_FILE_ACCESS_ERROR;
#endif