Windows 7: Bug in OpenFile()

Report any Hollywood bugs here
User avatar
Clyde
Posts: 349
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Windows 7: Bug in OpenFile()

Post 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
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Windows 7: Bug in OpenFile()

Post 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...
User avatar
Clyde
Posts: 349
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Windows 7: Bug in OpenFile()

Post by Clyde »

Yep, write permission is granted. I also tried to run both as normal user and administator. Same result.

Here is a screenshot:
Image

(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
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
amigaoneproductions
Posts: 32
Joined: Mon Feb 15, 2010 4:14 pm
Location: Nottinghamshire, UK
Contact:

Re: Windows 7: Bug in OpenFile()

Post 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)
User avatar
Clyde
Posts: 349
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Windows 7: Bug in OpenFile()

Post 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.
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
amigaoneproductions
Posts: 32
Joined: Mon Feb 15, 2010 4:14 pm
Location: Nottinghamshire, UK
Contact:

Re: Windows 7: Bug in OpenFile()

Post 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" )
User avatar
Clyde
Posts: 349
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Windows 7: Bug in OpenFile()

Post 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! :-)
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Windows 7: Bug in OpenFile()

Post 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 :)
amigaoneproductions
Posts: 32
Joined: Mon Feb 15, 2010 4:14 pm
Location: Nottinghamshire, UK
Contact:

Re: Windows 7: Bug in OpenFile()

Post 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
amigaoneproductions
Posts: 32
Joined: Mon Feb 15, 2010 4:14 pm
Location: Nottinghamshire, UK
Contact:

Re: Windows 7: Bug in OpenFile() - SOLVED ?

Post 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
Post Reply