Windows : ruby-created temporary directory not writable

Good evening,

for quite a long time already, I use Alex C.'s code in my program
“Crème Fraiche” (Sourceforge and Rubygems) to create temporary
directories.
The code had been on Stackoverflow for a wile:

and it is also accessible in this very forum:
https://www.ruby-forum.com/topic/169054#new

I just modified the routine slightly for my needs and because the ‘:’
delimiter has a different effect in Windows. :wink:
My version of the temp_dir function on pastebin:

Now a user sends me a bug report and a logger output which documents a
situation where the created directory is not writeable immediately
after creation (Errno::EACCES). I am not using any Windows-version and
do not have access to a Windows-machine.

Does anybody have an idea what happens?

The temporary directories are created with the prefix ‘Creme_Fraiche_’.
Apparently a sub-directory to
C:/Users/[user-name]/AppData/Local/Temp/
is created; for example
C:/Users/Angie/AppData/Local/Temp/Creme_Fraiche_1408696723_473

So the question is: How can a directory which is created by a program,
run by the user ‘Angie’ not be writeable to the same program during the
same session?

The same user reports that the error does not occur under Linux!

TIA,

Michael

Some antivirus programs block program access to temp folders, but don’t
block creation of temp folders. Have you checked that?

And how I will check that! :wink:
Thanks for the idea, Joel.

If it’s a security program blocking your access there wouldn’t be a
difference anyway.
Most of those programs have an option to “disable for 5 minutes”, which
would be a handy way to test whether that’s the issue.

As far as I know all the temp directories are within user profiles from
Vista onwards. There might be something available to “system”, but that
would probably end up running afoul of User Account Control.

I am still waiting for an answer to the question, whether a
virus-scanner blocks access to the temporary directory on the user’s
machine.

In the meantime I wonder how I could avoid using the user’s temporary
directory and have access to the system-wide temporary directory,
instead. On my Debian-system, Dir::tmpdir is anyway producing “/tmp”.

Having not used any Windows for years … almost a decade: Is there
still something like a system-wide temporary directory on Windows? There
had been C:\temp and also C:\Windows\temp at a time.

Or maybe this does not change anything.

Good evening,

I have at last the response of the Windows-user who reported the
problems with the temporary directories.

Joel P. wrote in post #1155744:

Some antivirus programs block program access to temp folders, but don’t
block creation of temp folders. Have you checked that?

All testing had been done “without AV”, which I interpret as “without
any anti virus-software being active on the computer”. My options are
the following:

-) file it away (hate that)
-) ask in a Windows-centric forum or newsgroup for ideas (hate that)
-) stop developing for MS-systems and ignore all issues which are
encountered on a MS-system.

As I want to stand upright and have fun developing software which serves
no particular purpose (did the other for too long), I think a decision
is overdue. All my software-projects are either completely ignored by
Linux-users or no Linux-user had ever anything to complain about. For
years, all the feedback I get comes from Windows-users who faced
problems that weren’t mine.

All’s fine, then. CLOFI.