Page 1 of 2
Windows 7: Bug in OpenFile()
Posted: Sun Feb 14, 2010 10:08 pm
by Clyde
Hi!
I want to pop up a FileRequester to tell me in which file I would like to write data. I do it this way:
Code: Select all
file$ = FileRequest("Choose file to write", "")
OpenFile(1, file$, #MODE_WRITE)
If the file exists, everything works fine. But if I set a name for a non-existing file - which means I want Hollywood to create that new file and write the data afterwards - I get an error message: File cannot be found. Make sure path is correct.
Under OS3.9 everything works fine and as expected.
Greetings
Re: Windows 7: Bug in OpenFile()
Posted: Tue Feb 16, 2010 12:06 pm
by airsoftsoftwair
Hmm, interesting. Are you sure that file system permissions allow you to write to the directory? I currently don't have a Windows 7 system here, so I can't test it myself...
Re: Windows 7: Bug in OpenFile()
Posted: Wed Feb 17, 2010 3:35 pm
by Clyde
Yep, write permission is granted. I also tried to run both as normal user and administator. Same result.
Here is a screenshot:
(Sorry to non-German speacking guys, but I just use the German version

)
Is it correct, that the file dialog says "Öffnen/Open"? Shouldn't it be "Speicher/Save" or something?
Greetings
Re: Windows 7: Bug in OpenFile()
Posted: Wed Feb 17, 2010 4:14 pm
by amigaoneproductions
I have ordered Hollywood, which should arrive in the next few days, I intend to run the Windows version on Windows 7, so I will be able to do some testing then if the problem has not been resolved.
I will say one thing, Windows 7 is a bit fussy where it will let you write or modify stuff, have you tried creating a file on a different drive than your system (Probably C:) partition, ie. D:\ or perhaps a memory stick formatted with FAT (FAT does not have the same write permission problems as NTFS)
Re: Windows 7: Bug in OpenFile()
Posted: Wed Feb 17, 2010 4:19 pm
by Clyde
Thanks for your anwer!
Yes, I am aware of Windows directory "problems". I didn't want to save to any system directories (on C:), I've choosen my seperate data partition.
Also, the Amiga version I run which works, runs under Amikit on that Windows 7. So if there would be problems with write permissions in Windows 7 I guess they would also arise when I use the Amiga version.
Re: Windows 7: Bug in OpenFile()
Posted: Wed Feb 17, 2010 4:27 pm
by amigaoneproductions
Yeah, I agree with you, it looks like it's not a permission problem then, sounds like a bug in hollywood, but if hollywood works on other Windows flavours, it's more likley a bug in Windows 7

which may need a "workaround".
Maybe something has changed in the Windows 7 API (To quote Scotty from Star Trek : "Engineers, they love to change things" )
Re: Windows 7: Bug in OpenFile()
Posted: Wed Feb 17, 2010 4:31 pm
by Clyde
Unfortunately I have no XP machine here right now to test it ... :-/
OT: Oh! You are a fellow Trekkie (or Trekker)? Great! So, live long and prosper!

Re: Windows 7: Bug in OpenFile()
Posted: Wed Feb 17, 2010 11:11 pm
by airsoftsoftwair
But there's really not much that could be wrong in Hollywood... using
OpenFile() with mode set to write will pretty much fall back directly to a standard fopen() C call. If that would be broken, then the Windows IDE wouldn't be able to save files, either. But the IDE is working fine, soo... well, I'd like to hear some more opinions from other Windows 7 users. I just can't imagine that it is Hollywood's fault

Re: Windows 7: Bug in OpenFile()
Posted: Thu Feb 18, 2010 12:08 am
by amigaoneproductions
I don't know if this is of any help
http://connect.microsoft.com/VisualStud ... -windows-7
fopen sometimes fails after calling DeleteFile on Windows 7
Looks like there could be a bug in Windows 7, but it does not seem to offer a solution.
If you have created the file once, then deleted it for another test, perhaps the file is not really deleted properly, please take a look and see what you make of it.
Edit:
Another possibly helpful link:
http://connect.microsoft.com/VisualStud ... -relatives
Maybe valid if Hollywood was written using Microsoft's documentation
Re: Windows 7: Bug in OpenFile() - SOLVED ?
Posted: Thu Feb 25, 2010 1:11 am
by amigaoneproductions
The problem is NOT OpenFile in the above code, it's in FileRequest, you are not telling it that you want to open a file for writing, so it defaults to reading, so quite rightly, it says "File not Found"
Try this :
Code: Select all
file$ = FileRequest("Choose file to write", "",#REQ_SAVEMODE )
From the Documentation
NAME
FileRequest -- pop up a file requester
SYNOPSIS
f$ = FileRequest(title$, pattern$[, mode, defdir$, deffile$])
NAME
FileRequest -- pop up a file requester
SYNOPSIS
f$ = FileRequest(title$, pattern$[, mode, defdir$, deffile$])
.......
mode - optional: mode to use; either #REQ_NORMAL, #REQ_SAVEMODE or
#REQ_MULTISELECT (defaults to #REQ_NORMAL) (V2.0)
Hope that helps