seperate multiple filenames by non-space character in pkg.m
John W. Eaton
jwe at bevo.che.wisc.edu
Thu Oct 2 13:04:02 CDT 2008
On 2-Oct-2008, Benjamin Lindner wrote:
| Benjamin Lindner wrote:
| > Hello,
| >
| > in octave 3.0.2 the package manager currently seperates multiple files
| > to be installed for a forge package by a space character.
| > This breaks if the filename(s) themselves contain spaces, since the call
| > to split() returns incorrect filenames
| >
| > The attached patch changes the behaviour to use the PATHSEP character
| > to separate multiple filenames.
|
|
| Sorry, should have been a hg changeset.
| # HG changeset patch
| # User Benjamin Lindner <lindnerb at users.sourceforge.net>
| # Date 1222931031 -7200
| # Node ID f2b6f72f6e540827a110f24be522908222567c6a
| # Parent 059df2762b229b355271b4814f211223ea5650fd
| separate multiple filenames by pathsep in pkg.m
|
| diff -r 059df2762b22 -r f2b6f72f6e54 ChangeLog
| --- a/ChangeLog Thu Oct 02 08:58:26 2008 +0200
| +++ b/ChangeLog Thu Oct 02 09:03:51 2008 +0200
| @@ -1,3 +1,7 @@
| +2008-10-02 Benjamin Lindner <lindnerb at users.sourceforge.net>
| +
| + * pkg.m : separate multiple files by pathsep
| +
| 2008-10-02 Benjamin Lindner <lindnerb at users.sourceforge.net>
|
| * pkg.m : enclose building directory in quotes
| diff -r 059df2762b22 -r f2b6f72f6e54 scripts/pkg/pkg.m
| --- a/scripts/pkg/pkg.m Thu Oct 02 08:58:26 2008 +0200
| +++ b/scripts/pkg/pkg.m Thu Oct 02 09:03:51 2008 +0200
| @@ -1288,14 +1288,14 @@
| filenames = sprintf (fullfile (src, "%s "), m.name);
| endif
| if (length (oct) > 0)
| - filenames = cstrcat (filenames, " ",
| - sprintf (fullfile (src, "%s "), oct.name));
| + filenames = cstrcat (filenames, pathsep,
| + sprintf (fullfile (src, ["%s",pathsep]), oct.name));
| endif
| if (length (mex) > 0)
| - filenames = cstrcat (filenames, " ",
| - sprintf (fullfile (src, "%s "), mex.name));
| + filenames = cstrcat (filenames, pathsep,
| + sprintf (fullfile (src, ["%s",pathsep]), mex.name));
| endif
| - filenames = split_by (filenames, " ");
| + filenames = split_by (filenames, pathsep);
| endif
|
| ## Split into architecture dependent and independent files
Shouldn't we also do the same thing for the .m files? Should we try
to avoid putting a trailing colon at the end of filenames?
Or, instead of
m = dir (fullfile (src, "*.m"));
oct = dir (fullfile (src, "*.oct"));
mex = dir (fullfile (src, "*.mex"));
archdependent = "";
archindependent = "";
filenames = "";
if (length (m) > 0)
filenames = sprintf (fullfile (src, "%s "), m.name);
endif
if (length (oct) > 0)
filenames = cstrcat (filenames, " ",
sprintf (fullfile (src, "%s "), oct.name));
endif
if (length (mex) > 0)
filenames = cstrcat (filenames, " ",
sprintf (fullfile (src, "%s "), mex.name));
endif
filenames = split_by (filenames, " ");
maybe we could simplify all of this by doing something like
m = dir (fullfile (src, "*.m"));
oct = dir (fullfile (src, "*.oct"));
mex = dir (fullfile (src, "*.mex"));
## FIXME -- we should not need the tests on size here, but there is
## a bug in concatenation with { } when an expression like oct.name
## produces nothing.
if (isempty (m)) mnames = { }; else mnames = { m.name }; endif
if (isempty (oct)) octnames = { }; else octnames = { oct.name }; endif
if (isempty (mex)) mexnames = { }; else mexnames = { mex.name }; endif
filenames = cellfun (@(x) fullfile (src, x), [mnames, octnames, mexnames],
"UniformOutput", false);
Of course this could be further simplified if the bug is fixed, so I'll
take a look at doing that.
Also, why are archdependent and archindependent even set in this
block? They appear to be set unconditionally just below.
jwe
More information about the Bug-octave
mailing list