Skip to content

Commit 9ce6fe9

Browse files
ZCubeGit for Windows Build Agent
authored andcommitted
mingw: move the file_attr_to_st_mode() function definition
In preparation for making this function a bit more complicated (to allow for special-casing the `ContainerMappedDirectories` in Windows containers, which look like a symbolic link, but are not), let's move it out of the header. Signed-off-by: JiSeop Moon <zcube@zcube.kr> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent dc6ea05 commit 9ce6fe9

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

compat/mingw.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3947,3 +3947,17 @@ int is_inside_windows_container(void)
39473947

39483948
return inside_container;
39493949
}
3950+
3951+
int file_attr_to_st_mode (DWORD attr, DWORD tag)
3952+
{
3953+
int fMode = S_IREAD;
3954+
if ((attr & FILE_ATTRIBUTE_REPARSE_POINT) && tag == IO_REPARSE_TAG_SYMLINK)
3955+
fMode |= S_IFLNK;
3956+
else if (attr & FILE_ATTRIBUTE_DIRECTORY)
3957+
fMode |= S_IFDIR;
3958+
else
3959+
fMode |= S_IFREG;
3960+
if (!(attr & FILE_ATTRIBUTE_READONLY))
3961+
fMode |= S_IWRITE;
3962+
return fMode;
3963+
}

compat/win32.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,7 @@
66
#include <windows.h>
77
#endif
88

9-
static inline int file_attr_to_st_mode (DWORD attr, DWORD tag)
10-
{
11-
int fMode = S_IREAD;
12-
if ((attr & FILE_ATTRIBUTE_REPARSE_POINT) && tag == IO_REPARSE_TAG_SYMLINK)
13-
fMode |= S_IFLNK;
14-
else if (attr & FILE_ATTRIBUTE_DIRECTORY)
15-
fMode |= S_IFDIR;
16-
else
17-
fMode |= S_IFREG;
18-
if (!(attr & FILE_ATTRIBUTE_READONLY))
19-
fMode |= S_IWRITE;
20-
return fMode;
21-
}
9+
extern int file_attr_to_st_mode (DWORD attr, DWORD tag);
2210

2311
static inline int get_file_attr(const char *fname, WIN32_FILE_ATTRIBUTE_DATA *fdata)
2412
{

0 commit comments

Comments
 (0)