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