Method: Train::File::Local::Windows#stat

Defined in:
lib/train/file/local/windows.rb

#statObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/train/file/local/windows.rb', line 32

def stat
  return @stat if defined?(@stat)

  begin
    file_stat =
      if @follow_symlink
        ::File.stat(@path)
      else
        ::File.lstat(@path)
      end
  rescue StandardError => _err
    return @stat = {}
  end

  @stat = {
    type: type,
    mode: file_stat.mode,
    mtime: file_stat.mtime.to_i,
    size: file_stat.size,
    owner: owner,
    uid: file_stat.uid,
    group: nil,
    gid: file_stat.gid,
    selinux_label: nil,
  }

  @stat
end