[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fileparts.m in octave (mingw and msvc)
From: |
John W. Eaton |
Subject: |
Re: fileparts.m in octave (mingw and msvc) |
Date: |
Tue, 27 Jan 2009 12:41:17 -0500 |
On 19-Jan-2009, Jaroslav Hajek wrote:
| On Mon, Jan 19, 2009 at 8:27 AM, Michael Goffioul
| <address@hidden> wrote:
| > On Mon, Jan 19, 2009 at 1:52 AM, Tatsuro MATSUOKA <address@hidden> wrote:
| >> OK. I agree with you.
| >> However, implementation of "filesep('all')" can not be done soon.
| >
| > Well, filesep('all') is already implemented in development branch.
| > It's just a matter of backporting. There was also some good proposals
| > for an efficient find_last_of implementation in
| > http://www.nabble.com/filesep-extension-td20441910.html#a20441910
| >
| > So I think everything is there to solve that problem elegantly.
| >
| > Michael.
| >
|
| Humm.. I see that was my proposal ended by "I'll commit a changeset."
| About time to fullfill the promise, I guess... hopefully today.
I see you added strchr, so I decided to look at fileparts. I think
the following change will work, but should we make strchr return 0 for
no match (similar to index/rindex) or an empty matrix like find? If
it returns 0 for no match, the change to fileparts is simpler.
jwe
diff --git a/scripts/miscellaneous/fileparts.m
b/scripts/miscellaneous/fileparts.m
--- a/scripts/miscellaneous/fileparts.m
+++ b/scripts/miscellaneous/fileparts.m
@@ -27,7 +27,10 @@
if (nargin == 1)
if (ischar (filename))
- ds = rindex (filename, filesep);
+ ds = strchr (filename, filesep ("all"), 1, "last");
+ if (isempty (ds))
+ ds = 0;
+ endif
es = rindex (filename, ".");
## These can be the same if they are both 0 (no dir or ext).
if (es <= ds)
- fileparts.m in octave (mingw and msvc), Tatsuro MATSUOKA, 2009/01/18
- Re: fileparts.m in octave (mingw and msvc), Tatsuro MATSUOKA, 2009/01/18
- Re: fileparts.m in octave (mingw and msvc), Michael Goffioul, 2009/01/18
- Re: fileparts.m in octave (mingw and msvc), Tatsuro MATSUOKA, 2009/01/18
- Re: fileparts.m in octave (mingw and msvc), Michael Goffioul, 2009/01/19
- Re: fileparts.m in octave (mingw and msvc), Jaroslav Hajek, 2009/01/19
- Re: fileparts.m in octave (mingw and msvc), Tatsuro MATSUOKA, 2009/01/19
- Re: fileparts.m in octave (mingw and msvc), Jaroslav Hajek, 2009/01/21
- Re: fileparts.m in octave (mingw and msvc),
John W. Eaton <=