[m-rev.] for review: library changes for `mmc --make' on Windows

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jul 15 16:02:58 AEST 2003


On 15-Jul-2003, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> +io__check_file_accessibility_dotnet(FileName, AccessTypes, Result, !IO) :-
> +	CheckRead0 = pred_to_bool(access_types_includes_read(AccessTypes)),
> +	CheckWrite = pred_to_bool(access_types_includes_write(AccessTypes)),
> +
> +	CheckExec = pred_to_bool(access_types_includes_execute(AccessTypes)),
> +	% We need to be able to read a file to execute it.
> +	CheckRead = bool__or(CheckRead0, CheckExec),
>  
> -").
> +	io__file_type(yes, FileName, FileTypeRes, !IO),
> +	(
> +		FileTypeRes = ok(FileType),
> +		( FileType = directory ->
> +			check_directory_accessibility_dotnet(FileName,
> +				to_int(CheckRead), to_int(CheckWrite),
> +				Result, !IO)
> +		;
> +			( CheckRead = yes ->
> +				io__open_input(FileName, InputRes, !IO),
> +				(
> +					InputRes = ok(InputStream),
> +					io__close_input(InputStream, !IO),
> +					CheckReadRes = ok
> +				;
> +					InputRes = error(InputError),
> +					CheckReadRes = error(InputError)
> +				)
> +			;
> +				CheckReadRes = ok
> +			),
> +			( CheckReadRes = ok, CheckWrite = yes ->
> +				io__open_append(FileName, OutputRes, !IO),
> +				(
> +					OutputRes = ok(OutputStream),
> +					io__close_output(OutputStream, !IO),
> +					CheckWriteRes = ok
> +				;
> +					OutputRes = error(OutputError),
> +					CheckWriteRes = error(OutputError)
> +				)
> +			;
> +				CheckWriteRes = CheckReadRes
> +			),
> +			(
> +				CheckWriteRes = ok,
> +
> +				% Unix programs need to check whether the
> +				% execute bit is set for the directory, but
> +				% we can't actually execute the directory.
> +				FileType \= directory,
> +				CheckExec = yes

This code is already in the FileType \= directory case of the containing
if-then-else, so I don't see the point of duplicating that check here.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list