src/hotspot/os/windows/os_windows.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff src/hotspot/os/windows

src/hotspot/os/windows/os_windows.cpp

Print this page




4367       errno = ::GetLastError();
4368     }
4369     destroy_unc_path(wpath);
4370   }
4371   os::free(pathbuf);
4372   return ret;
4373 }
4374 
4375 FILE* os::open(int fd, const char* mode) {
4376   return ::_fdopen(fd, mode);
4377 }
4378 
4379 // Is a (classpath) directory empty?
4380 bool os::dir_is_empty(const char* path) {
4381   char* search_path = (char*)os::malloc(strlen(path) + 3, mtInternal);
4382   if (search_path == NULL) {
4383     errno = ENOMEM;
4384     return false;
4385   }
4386   strcpy(search_path, path);

4387   // Append "*", or possibly "\\*", to path
4388   if (path[1] == ':' &&
4389     (path[2] == '\0' ||
4390     (path[2] == '\\' && path[3] == '\0'))) {
4391     // No '\\' needed for cases like "Z:" or "Z:\"
4392     strcat(search_path, "*");
4393   }
4394   else {
4395     strcat(search_path, "\\*");
4396   }
4397   errno_t err = ERROR_SUCCESS;
4398   wchar_t* wpath = create_unc_path(search_path, err);
4399   if (err != ERROR_SUCCESS) {
4400     if (wpath != NULL) {
4401       destroy_unc_path(wpath);
4402     }
4403     os::free(search_path);
4404     errno = err;
4405     return false;
4406   }
4407   WIN32_FIND_DATAW fd;
4408   HANDLE f = ::FindFirstFileW(wpath, &fd);
4409   destroy_unc_path(wpath);
4410   bool is_empty = true;




4367       errno = ::GetLastError();
4368     }
4369     destroy_unc_path(wpath);
4370   }
4371   os::free(pathbuf);
4372   return ret;
4373 }
4374 
4375 FILE* os::open(int fd, const char* mode) {
4376   return ::_fdopen(fd, mode);
4377 }
4378 
4379 // Is a (classpath) directory empty?
4380 bool os::dir_is_empty(const char* path) {
4381   char* search_path = (char*)os::malloc(strlen(path) + 3, mtInternal);
4382   if (search_path == NULL) {
4383     errno = ENOMEM;
4384     return false;
4385   }
4386   strcpy(search_path, path);
4387   os::native_path(search_path);
4388   // Append "*", or possibly "\\*", to path
4389   if (search_path[1] == ':' &&
4390        (search_path[2] == '\0' ||
4391          (search_path[2] == '\\' && search_path[3] == '\0'))) {
4392     // No '\\' needed for cases like "Z:" or "Z:\"
4393     strcat(search_path, "*");
4394   }
4395   else {
4396     strcat(search_path, "\\*");
4397   }
4398   errno_t err = ERROR_SUCCESS;
4399   wchar_t* wpath = create_unc_path(search_path, err);
4400   if (err != ERROR_SUCCESS) {
4401     if (wpath != NULL) {
4402       destroy_unc_path(wpath);
4403     }
4404     os::free(search_path);
4405     errno = err;
4406     return false;
4407   }
4408   WIN32_FIND_DATAW fd;
4409   HANDLE f = ::FindFirstFileW(wpath, &fd);
4410   destroy_unc_path(wpath);
4411   bool is_empty = true;


src/hotspot/os/windows/os_windows.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File