[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

file name and path expansion

From: Martin.Hepperle
Subject: file name and path expansion
Date: Fri, 3 Sep 2010 03:36:32 -0700 (PDT)

Hello All,

I have added tilde expansion to the javaadd() and javarmpath() function files, to allow for accessing Java files relative to the user's home directory, to avoid hard coded path names. However this topic may be worth to think about a more global design decision.

Should all file related functions automatically expand tildes as well as environment variables?
% this works of course:
> fp = fopen('z:/file.txt')
fp =  3
> fclose(fp)
ans = 0

% should environment variables be expanded automatically?
% Matlab does NOT do it.
> setenv('PP','Z:')
% on Windows
> fp = fopen('%PP%/file.txt')
% or on Unix:
> fp = fopen('$PP/file.txt')
fp = -1

% should tilde be expanded automatically to the user's home directory?
% Matlab does NOT do it.
> fp = fopen('~/file.txt')
fp = -1
If Matlab compatibility is desired, the current behavior is correct.

In any case, at least a function env_expand() equivalent to tilde_expand() for expanding environment variables in a string would be helpful, if it does not yet exist(?).

Any opinions? Regards, Martin

View this message in context: file name and path expansion
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]