Re: [cc65] Filenames for POSIX functins on CBM targets

From: Groepaz <groepaz1gmx.net>
Date: 2012-08-10 19:23:35
On Friday 10 August 2012, you wrote:
> > btw, to make clear what i mean.... it should always be possible to
> > retrieve a filename by readdir, and then opening the file by fopen using
> > the exact string returned by readdir.
> 
> Generally this isn't the case on any OS I know of.

hu? i am doing exactly that in many of my programs. yes you have to assume the 
concept of "current drive" and/or "current working directory" is present 
(which it almost certainly is) and that the directory is read from the current 
drive.

> > that pretty much rules out any solution that requires to
> > specify the drive and/or device number. and it also rules out any
> > solution that can not deal with whatever is a valid filename.
> 
> I can't follow you at all here. All readir() implementations I know of
> return the filename only, no relative path, no absolute path.
> 
> So what you describe above works this way _only_ if the directory read
> is ".". The sample 'multidemo' does exactly this.

yes, see above
 
> But if you read any other directory then it is your task to either
> - prepend the directory name you read to the file name you want to
> open (and a path delimiter)
> or
> - chdir() to the directory before opening the file

or in the real existing CBM world: always do CHDIR, because opening a file by 
using the full path can not be done (not on any drive i am aware of at least) 
:) (and the directory will also always come from the current working directory 
of the respective drive).

> The only issue is the missing delimiter. If the majority here likes it
> better I could as well live with opendir()/chdir()/getcwd() omiting
> the last ':' like in "8:0" so that the colon can be defined as
> delimiter.

the point i am trying to make is, that in a "standard situation" (which is: 
one drive, one unit, working from the current directory) it should never be 
required to bother about adding a drive or device number, especially not 
prepending something to a string everytime a file is opened.

-- 

http://www.hitmen-console.org    http://magicdisk.untergrund.net
http://www.pokefinder.org        http://ftp.pokefinder.org

Jeden Tag 19 Millionen Euro f�r "unabh�ngiges" Fernsehen?

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Aug 10 19:22:30 2012

This archive was generated by hypermail 2.1.8 : 2012-08-10 19:22:33 CEST