[Scummvm-devel] File handling revamp

Max Horn max at quendi.de
Fri Aug 1 13:17:10 CEST 2008


Am Fr, 1.08.2008, 13:09, schrieb Torbjörn Andersson:
> Max Horn wrote:
>
>> Fine by me. So, how do we determine what native line breaks are?
>>  #if WINDOWS
>>    stream.writeByte('\r');
>>  #else
>>    stream.writeByte('\n');
>>  #endif
>
> I don't know if stream.writeString("\n") would do the trick. Aquadran
> mentioned something about it not working, because of something in the
> String class.

Hu? No, the String class has nothing to do with it. The only thing that is
relevant here is that currently we alreays open files in binary mode,
never in text mode, hence the system does not perform automatic endline
conversion for us.

> In that case, perhaps we to do some #if/#ifdef like that
> after all, but in that case we should perhaps add a separate function
> for it in the stream class?
>

Well, we could add support for text mode when reading/writing user
editable text files (the config file -- aaaannnd... ??), which would be
one way to "solve" the issue. Of course it would make the file handling
code more complex again.

Could you remind me again why we need to support this for anything but
config files? :)

Max




More information about the Scummvm-devel mailing list