Cannot edit hidden file in windows?


#1

i get an error if i try to save an edited hidden file in windows

right click file and check “Hidden” try to save, cannot
right click file and uncheck “Hidden” try to save, can

Uncaught Error: EPERM, operation not permitted ‘c:\Users\Rakka Rage\Desktop\test.txt’ c:\ProgramData\chocolatey\lib\Atom.0.127.0\tools\Atom\resources\app\node_modules\pathwatcher\lib\file.js:237


#2

What happens if you close atom, change it to hidden, and open it back up?


#3

thanks
i still get the same message if hidden before or after

BUT: actually it is saving it just gives that error and does not clear the dirty graphic on tab


#4

Same problem here (I’m running Windows 8.1)


#5

still happening… and it does not always save…
hidden is not read only and should be writable
anyone know why it is doing this? or can someone check mac or unix if the same behaviour?
it takes a long time too to make a failed attempt to save and pop up an error box
thanks


#6

Unix and its variants doesn’t have the same kind of hidden files concept as Windows. There isn’t a “hidden” attribute in Unix file systems like there is in FAT and NTFS, so I wouldn’t expect OS X or Linux to operate the same way.


#7

It seems there is an issue within node itself when writing to hidden files. I created to files: test.txt and test-hidden.txt, and set test-hidden.txt to hide.

This is what happened when I tried to write aaa to both of the files.

> fs = require('fs');
  [object Object]
> fs.writeFileSync('./test.txt', 'aaa');
  undefined
> fs.writeFileSync('./test-hidden.txt', 'aaa');
  Error: EPERM, operation not permitted 'C:\Users\IEUser\test-hidden.txt'
    at Object.fs.openSync (fs.js:439:18)
    at Object.fs.writeFileSync (fs.js:978:15)
    at repl:1:5
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.emit (events.js:95:17)
    at Interface._onLine (readline.js:203:10)
    at Interface._line (readline.js:532:8)
    at Interface._ttyWrite (readline.js:761:14)
    at ReadStream.onkeypress (readline.js:100:10)

This happened on both a “normal” and an “elevated” or “admin” command prompt.

Note: I tried this on a Windows running in VirtualBox
Windows 8.1
Node 0.10.35


#8

What do you get when you do an fs.statSync on the hidden file?


#9
> fs.statSync('test.txt')
{ dev: 0,
  mode: 33206,
  nlink: 1,
  uid: 0,
  gid: 0,
  rdev: 0,
  ino: 0,
  size: 3,
  atime: Mon Jan 12 2015 10:07:09 GMT-0800 (Pacific Standard Time),
  mtime: Mon Jan 12 2015 10:21:12 GMT-0800 (Pacific Standard Time),
  ctime: Mon Jan 12 2015 10:07:09 GMT-0800 (Pacific Standard Time) }
> fs.statSync('test-hidden.txt')
{ dev: 0,
  mode: 33206,
  nlink: 1,
  uid: 0,
  gid: 0,
  rdev: 0,
  ino: 0,
  size: 0,
  atime: Mon Jan 12 2015 10:07:15 GMT-0800 (Pacific Standard Time),
  mtime: Mon Jan 12 2015 10:07:15 GMT-0800 (Pacific Standard Time),
  ctime: Mon Jan 12 2015 10:07:09 GMT-0800 (Pacific Standard Time) }