bug in edit.m

John W. Eaton jwe at bevo.che.wisc.edu
Tue Jan 15 17:36:19 CST 2008


On 15-Jan-2008, Ben Abbott wrote:

| On Jan 15, 2008, at 6:11 PM, John W. Eaton wrote:
|
| >  edit /foo.m      %% / exists, but no write access; opens ./foo.m  
| > instead
| >
| >  edit /bar/foo.m  %% /bar does not exist => error
| >
| > jwe
| 
| Regarding the 1st, from Matlab 2007b, the command below opens the file  
| in its original path, but as "Read Only".
| 
|  >> edit /sw/share/octave/3.0.0+/m/polynomial/residue.m

Maybe my example above wasn't clear.  I meant that the directory /
exists but without the file foo.m.

| However, if I try to open a non-existent file ...
| 
|  >> edit /bar/foo.m
| ??? Error using ==> edit>handleError at 462
| File '/bar/foo.m' not found.

So it seems that we might want to do

  set edit directory to FUNCTION.HOME if it exists; otherwise, use "."

  if file exists and is writable, open it

  if file exists but is not writable, then
    if file of the same name does not exist in edit directory, copy to
    edit directory and open it; otherwise, open existing file in edit
    directory
  
  if file does not exist but directory does, then
    if directory is writable, open file in existing directory;
    otherwise, open file in edit directory

  In all cases, if edit directory is not writable, punt.

Is that reasonable behavior?  WDMD in all of these cases?

jwe


More information about the Bug-octave mailing list