[Gambas-user] Stat() Auth and Mode (misunderstanding or bug?)
Tobias Boege
taboege at ...626...
Thu Sep 18 14:15:12 CEST 2014
On Thu, 18 Sep 2014, Willy Raets wrote:
> On do, 2014-09-18 at 01:53 +0200, Beno??t Minisini wrote:
> > Le 18/09/2014 01:50, Willy Raets a ??crit :
> > > Hi all,
> > >
> > > Following was brought to my attention:
> > >
> > > To reproduce make a file named test in your home folder.
> > > Create a console project in IDE with any name you like
> > >
> > > Public Sub Main()
> > >
> > > Dim sPath As String
> > > sPath = User.Home &/ "test"
> > > With Stat(sPath)
> > > Print "Auth: " & .Auth
> > > Print "Mode: " & .Mode
> > > End With
> > >
> > > End
> > >
> > > Run the project.
> > > Output is:
> > >
> > > Auth: rw-r--r--
> > > Mode: 420
> > >
> > > Should mode not be 644 or do I misunderstand Stat().Mode?
> > >
> > > user rw- = 6
> > > group r-- = 4
> > > other r-- = 4
> > >
> >
> > 644 is octal. In decimal it is 420.
>
> That explains a lot and at the same time it is confusing as I got used
> to octal representation when running chmod on linux.
>
> I guess I'll have to rewire my brain when using Stat().Mode in Gambas :)
>
Think of it as: Mode returns an Integer. Integers only have *values*, they
do *not* come with specific representation information, like a number base.
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User
mailing list