Skip to content

Commit

Permalink
Chattr / chflags dialog: warning if try symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
akruphi committed Jan 7, 2025
1 parent 53f6d35 commit 80dc762
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
11 changes: 11 additions & 0 deletions far2l/bootstrap/scripts/farlang.templ.m4
Original file line number Diff line number Diff line change
Expand Up @@ -17240,6 +17240,17 @@ upd:"Chattr/chflags only applicable to a real object accessible locally.\nCurren
upd:"Chattr/chflags only applicable to a real object accessible locally.\nCurrently, the plugin panel does not have a real file system object."
upd:"Chattr/chflags only applicable to a real object accessible locally.\nCurrently, the plugin panel does not have a real file system object."

ChAttrWarnNoSymlinks
"Не применимо к символьным ссылкам"
"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"
upd:"Chattr/chflags not applicable to symlinks"

ChAttrErrorGetFlags
"Не удается получить флаги для \"%ls\":\n"
"Cannot get flags of \"%ls\":\n"
Expand Down
20 changes: 14 additions & 6 deletions far2l/src/chattr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Copyright (c) 2025- Far2l Group
#include "FSFileFlags.h"

static struct {
unsigned long flag;
char name_short;
const char *name_long;
unsigned long flag;
char name_short;
const char *name_long;
} flags_list[] = {
#ifdef __linux__
// for linux systems see actual constants in <linux/fs.h>
Expand Down Expand Up @@ -117,7 +117,7 @@ static struct {
#endif
#endif

#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
// see actual constants in <sys/stat.h>
// Super-user and owner changeable flags
#ifdef UF_NODUMP // 0x00000001
Expand Down Expand Up @@ -176,7 +176,7 @@ static struct {
{ SF_NOUNLINK, '+', "sunlink: file may not be removed or renamed (super-user only)" },
#endif
#ifdef SF_SNAPSHOT // 0x00200000
{ SF_SNAPSHOT, '+', "snapshot: snapshot inode (filesystems do not allow changing this flag)" },
{ SF_SNAPSHOT, '+', "snapshot: snapshot inode (filesystems do not allow changing this flag)" },
#endif
#endif
};
Expand Down Expand Up @@ -320,9 +320,17 @@ bool ChattrDialog(Panel *SrcPanel)
FARString strSelName;
DWORD FileAttr, FileMode;
SrcPanel->GetSelName(nullptr, FileAttr, FileMode);
SrcPanel->GetSelName(&strSelName, FileAttr, FileMode);
SrcPanel->GetSelName(&strSelName, FileAttr, FileMode);
//SrcPanel->GetCurName(strSelName);

if (FileAttr & FILE_ATTRIBUTE_REPARSE_POINT) {
ExMessager em(Msg::ChAttrTitle);
em.AddMultiline(Msg::ChAttrWarnNoSymlinks);
em.AddDup(Msg::Ok);
em.Show(MSG_WARNING, 1);
return false;
}

if (TestParentFolderName(strSelName))
return false;

Expand Down

0 comments on commit 80dc762

Please sign in to comment.