making some changes to ompi_config_bottom and also changing the logic for windows portion of ompi_empty_dir
This commit was SVN r3480.
Этот коммит содержится в:
родитель
a1100aead3
Коммит
5cac9a3498
@ -13,7 +13,7 @@
|
||||
#ifndef OMPI_CONFIG_BOTTOM_H
|
||||
#define OMPI_CONFIG_BOTTOM_H
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && defined(OMPI_BUILDING)
|
||||
#include "win32/win_compat.h"
|
||||
#define OMPI_COMP_EXPORT __declspec(dllexport)
|
||||
#endif
|
||||
|
@ -425,29 +425,36 @@ ompi_dir_empty(char *pathname)
|
||||
}
|
||||
#else
|
||||
bool empty = false;
|
||||
char search_path[MAX_PATH];
|
||||
HANDLE file;
|
||||
WIN32_FIND_DATA file_data;
|
||||
TCHAR *file_name;
|
||||
|
||||
if (NULL != pathname) {
|
||||
if (INVALID_HANDLE_VALUE == (file = FindFirstFile(pathname, &file_data))) {
|
||||
strncpy(search_path, pathname, strlen(pathname)+1);
|
||||
strncat (search_path, "\\*", 3);
|
||||
file = FindFirstFile(search_path, &file_data);
|
||||
|
||||
if (INVALID_HANDLE_VALUE == file) {
|
||||
FindClose(&file_data);
|
||||
return;
|
||||
} else while (!empty) {
|
||||
}
|
||||
|
||||
do {
|
||||
if ((0 != strcmp(file_data.cFileName, ".")) &&
|
||||
(0 != strcmp(file_data.cFileName, "..")) &&
|
||||
(!(file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) &&
|
||||
(0 != strncmp(file_data.cFileName,"output-", strlen("output-"))) &&
|
||||
(0 != strcmp(file_data.cFileName,"universe-setup.txt-"))) {
|
||||
/*remove the file */
|
||||
file_name = ompi_os_path(false, pathname, file_data.cFileName, NULL);
|
||||
DeleteFile(file_name);
|
||||
(0 != strcmp(file_data.cFileName, "..")) &&
|
||||
(!(file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) &&
|
||||
(0 != strncmp(file_data.cFileName,"output-", strlen("output-"))) &&
|
||||
(0 != strcmp(file_data.cFileName,"universe-setup.txt-"))) {
|
||||
|
||||
file_name = ompi_os_path(false, pathname, file_data.cFileName, NULL);
|
||||
DeleteFile(file_name);
|
||||
|
||||
}
|
||||
if (!FindNextFile(pathname, &file_data)) {
|
||||
if (ERROR_NO_MORE_FILES == GetLastError()) {
|
||||
if (!FindNextFile(search_path, &file_data)) {
|
||||
empty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while(!empty);
|
||||
FindClose(&file_data);
|
||||
}
|
||||
#endif
|
||||
@ -476,30 +483,34 @@ static bool ompi_is_empty(char *pathname)
|
||||
}
|
||||
return false;
|
||||
#else
|
||||
/* ANJU: check this logic again PLEASE */
|
||||
bool empty = true;
|
||||
char search_path[MAX_PATH];
|
||||
HANDLE file;
|
||||
WIN32_FIND_DATA file_data;
|
||||
|
||||
if (NULL != pathname) {
|
||||
if (!(INVALID_HANDLE_VALUE == (file = FindFirstFile(pathname, &file_data)))) {
|
||||
while(empty) {
|
||||
if ((0 != strcmp(file_data.cFileName, ".")) &&
|
||||
(0 != strcmp(file_data.cFileName, ".."))) {
|
||||
if (!FindNextFile(pathname, &file_data)) {
|
||||
if (ERROR_NO_MORE_FILES == GetLastError()) {
|
||||
empty = true;
|
||||
} else {
|
||||
empty = false;
|
||||
}
|
||||
} else {
|
||||
empty = false;
|
||||
}
|
||||
}
|
||||
} /* end while */
|
||||
} /* endif */
|
||||
} /* end outer if */
|
||||
return empty;
|
||||
strncpy(search_path, pathname, strlen(pathname)+1);
|
||||
strncat (search_path, "\\*", 3);
|
||||
|
||||
file = FindFirstFile(search_path, &file_data);
|
||||
if (INVALID_HANDLE_VALUE == file) {
|
||||
FindClose(&file_data);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (0 != strcmp(file_data.cFileName, ".") || 0 != strcmp(file_data.cFileName, "..")) {
|
||||
FindClose(&file_data);
|
||||
return false;
|
||||
}
|
||||
|
||||
while (0 != FindNextFile(search_path, &file_data)) {
|
||||
if (0 != strcmp(file_data.cFileName, ".") || 0 != strcmp(file_data.cFileName, "..")) {
|
||||
FindClose(&file_data);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FindClose(&file_data);
|
||||
return true;
|
||||
#endif /* ifndef WIN32 */
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/I"../../src/win32/generated_include" /I"../../include" /DOMPI_WINDOWS"
|
||||
AdditionalOptions="/I"../../src/win32/generated_include" /I"../../include" /DWIN32"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
@ -117,7 +117,7 @@
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\src\tools\openmpi\openmpi.c">
|
||||
RelativePath="hello.c">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user