mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
dll: fuse: dot_hidden option adds hidden file attribute on dot files
This commit is contained in:
parent
9dcc04f882
commit
8beb534340
@ -71,6 +71,9 @@ static struct fuse_opt fsp_fuse_core_opts[] =
|
|||||||
FSP_FUSE_CORE_OPT("rellinks", rellinks, 1),
|
FSP_FUSE_CORE_OPT("rellinks", rellinks, 1),
|
||||||
FSP_FUSE_CORE_OPT("norellinks", rellinks, 0),
|
FSP_FUSE_CORE_OPT("norellinks", rellinks, 0),
|
||||||
|
|
||||||
|
FSP_FUSE_CORE_OPT("dot_hidden", dot_hidden, 1),
|
||||||
|
FSP_FUSE_CORE_OPT("nodot_hidden", dot_hidden, 0),
|
||||||
|
|
||||||
FUSE_OPT_KEY("fstypename=", 'F'),
|
FUSE_OPT_KEY("fstypename=", 'F'),
|
||||||
FUSE_OPT_KEY("volname=", 'v'),
|
FUSE_OPT_KEY("volname=", 'v'),
|
||||||
|
|
||||||
@ -244,6 +247,7 @@ static int fsp_fuse_core_opt_proc(void *opt_data0, const char *arg, int key,
|
|||||||
" -o uid=N set file owner (-1 for mounting user id)\n"
|
" -o uid=N set file owner (-1 for mounting user id)\n"
|
||||||
" -o gid=N set file group (-1 for mounting user group)\n"
|
" -o gid=N set file group (-1 for mounting user group)\n"
|
||||||
" -o rellinks interpret absolute symlinks as volume relative\n"
|
" -o rellinks interpret absolute symlinks as volume relative\n"
|
||||||
|
" -o dot_hidden dot files have the Windows hidden file attrib\n"
|
||||||
" -o volname=NAME set volume label\n"
|
" -o volname=NAME set volume label\n"
|
||||||
" -o VolumePrefix=UNC set UNC prefix (/Server/Share)\n"
|
" -o VolumePrefix=UNC set UNC prefix (/Server/Share)\n"
|
||||||
" --VolumePrefix=UNC set UNC prefix (\\Server\\Share)\n"
|
" --VolumePrefix=UNC set UNC prefix (\\Server\\Share)\n"
|
||||||
@ -425,6 +429,7 @@ FSP_FUSE_API struct fuse *fsp_fuse_new(struct fsp_fuse_env *env,
|
|||||||
f->set_uid = opt_data.set_uid; f->uid = opt_data.uid;
|
f->set_uid = opt_data.set_uid; f->uid = opt_data.uid;
|
||||||
f->set_gid = opt_data.set_gid; f->gid = opt_data.gid;
|
f->set_gid = opt_data.set_gid; f->gid = opt_data.gid;
|
||||||
f->rellinks = opt_data.rellinks;
|
f->rellinks = opt_data.rellinks;
|
||||||
|
f->dot_hidden = opt_data.dot_hidden;
|
||||||
f->ThreadCount = opt_data.ThreadCount;
|
f->ThreadCount = opt_data.ThreadCount;
|
||||||
memcpy(&f->ops, ops, opsize);
|
memcpy(&f->ops, ops, opsize);
|
||||||
f->data = data;
|
f->data = data;
|
||||||
|
@ -429,6 +429,15 @@ static NTSTATUS fsp_fuse_intf_GetFileInfoFunnel(FSP_FILE_SYSTEM *FileSystem,
|
|||||||
}
|
}
|
||||||
if (StatEx)
|
if (StatEx)
|
||||||
FileInfo->FileAttributes |= fsp_fuse_intf_MapFlagsToFileAttributes(stbuf.st_flags);
|
FileInfo->FileAttributes |= fsp_fuse_intf_MapFlagsToFileAttributes(stbuf.st_flags);
|
||||||
|
if (f->dot_hidden)
|
||||||
|
{
|
||||||
|
const char *basename = PosixPath;
|
||||||
|
for (const char *p = PosixPath; '\0' != *p; p++)
|
||||||
|
if ('/' == *p)
|
||||||
|
basename = p + 1;
|
||||||
|
if ('.' == basename[0])
|
||||||
|
FileInfo->FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
|
||||||
|
}
|
||||||
FileInfo->FileSize = stbuf.st_size;
|
FileInfo->FileSize = stbuf.st_size;
|
||||||
FileInfo->AllocationSize =
|
FileInfo->AllocationSize =
|
||||||
(FileInfo->FileSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit;
|
(FileInfo->FileSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit;
|
||||||
@ -1712,7 +1721,7 @@ int fsp_fuse_intf_AddDirInfo(void *buf, const char *name,
|
|||||||
UINT32 Uid, Gid, Mode;
|
UINT32 Uid, Gid, Mode;
|
||||||
NTSTATUS Result0;
|
NTSTATUS Result0;
|
||||||
|
|
||||||
Result0 = fsp_fuse_intf_GetFileInfoFunnel(dh->FileSystem, 0, 0, stbuf,
|
Result0 = fsp_fuse_intf_GetFileInfoFunnel(dh->FileSystem, name, 0, stbuf,
|
||||||
&Uid, &Gid, &Mode, 0, &DirInfo->FileInfo);
|
&Uid, &Gid, &Mode, 0, &DirInfo->FileInfo);
|
||||||
if (NT_SUCCESS(Result0))
|
if (NT_SUCCESS(Result0))
|
||||||
DirInfo->Padding[0] = 1; /* HACK: remember that the FileInfo is valid */
|
DirInfo->Padding[0] = 1; /* HACK: remember that the FileInfo is valid */
|
||||||
|
@ -53,6 +53,7 @@ struct fuse
|
|||||||
int set_uid, uid;
|
int set_uid, uid;
|
||||||
int set_gid, gid;
|
int set_gid, gid;
|
||||||
int rellinks;
|
int rellinks;
|
||||||
|
int dot_hidden;
|
||||||
unsigned ThreadCount;
|
unsigned ThreadCount;
|
||||||
struct fuse_operations ops;
|
struct fuse_operations ops;
|
||||||
void *data;
|
void *data;
|
||||||
@ -140,7 +141,8 @@ struct fsp_fuse_core_opt_data
|
|||||||
set_uid, uid,
|
set_uid, uid,
|
||||||
set_gid, gid,
|
set_gid, gid,
|
||||||
set_attr_timeout, attr_timeout,
|
set_attr_timeout, attr_timeout,
|
||||||
rellinks;
|
rellinks,
|
||||||
|
dot_hidden;
|
||||||
int set_FileInfoTimeout,
|
int set_FileInfoTimeout,
|
||||||
set_DirInfoTimeout,
|
set_DirInfoTimeout,
|
||||||
set_EaTimeout,
|
set_EaTimeout,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user