mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 16:33:02 -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("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("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 gid=N set file group (-1 for mounting user group)\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 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_gid = opt_data.set_gid; f->gid = opt_data.gid;
|
||||
f->rellinks = opt_data.rellinks;
|
||||
f->dot_hidden = opt_data.dot_hidden;
|
||||
f->ThreadCount = opt_data.ThreadCount;
|
||||
memcpy(&f->ops, ops, opsize);
|
||||
f->data = data;
|
||||
|
@ -429,6 +429,15 @@ static NTSTATUS fsp_fuse_intf_GetFileInfoFunnel(FSP_FILE_SYSTEM *FileSystem,
|
||||
}
|
||||
if (StatEx)
|
||||
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->AllocationSize =
|
||||
(FileInfo->FileSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit;
|
||||
@ -1712,7 +1721,7 @@ int fsp_fuse_intf_AddDirInfo(void *buf, const char *name,
|
||||
UINT32 Uid, Gid, Mode;
|
||||
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);
|
||||
if (NT_SUCCESS(Result0))
|
||||
DirInfo->Padding[0] = 1; /* HACK: remember that the FileInfo is valid */
|
||||
|
@ -53,6 +53,7 @@ struct fuse
|
||||
int set_uid, uid;
|
||||
int set_gid, gid;
|
||||
int rellinks;
|
||||
int dot_hidden;
|
||||
unsigned ThreadCount;
|
||||
struct fuse_operations ops;
|
||||
void *data;
|
||||
@ -140,7 +141,8 @@ struct fsp_fuse_core_opt_data
|
||||
set_uid, uid,
|
||||
set_gid, gid,
|
||||
set_attr_timeout, attr_timeout,
|
||||
rellinks;
|
||||
rellinks,
|
||||
dot_hidden;
|
||||
int set_FileInfoTimeout,
|
||||
set_DirInfoTimeout,
|
||||
set_EaTimeout,
|
||||
|
Loading…
x
Reference in New Issue
Block a user