comparison libinterp/octave-value/ov-java.cc @ 15798:ac9e34f83522

Allow one char paths, like '/', in javaclasspath.txt * libinterp/octave-value/ov-java.cc(read_classpath.txt): Process line if length is > 0, not 1. Eliminate CamelCase variable iLast. Trim all whitespace from path before adding to static classpath.
author Rik <rik@octave.org>
date Sat, 15 Dec 2012 22:47:26 -0800
parents 492893b98eef
children d9b8333df5e4
comparison
equal deleted inserted replaced
15797:492893b98eef 15798:ac9e34f83522
291 291
292 while (! fs.eof () && ! fs.fail ()) 292 while (! fs.eof () && ! fs.fail ())
293 { 293 {
294 std::getline (fs, line); 294 std::getline (fs, line);
295 295
296 if (line.length () > 1) 296 if (line.length () > 0)
297 { 297 {
298 if (line.at(0) == '#' || line.at(0) == '%') 298 if (line[0] == '#' || line[0] == '%')
299 ; // skip comments 299 ; // skip comments
300 else 300 else
301 { 301 {
302 // prepend separator character 302 // prepend separator character
303 classpath.append (dir_path::path_sep_str ()); 303 classpath.append (dir_path::path_sep_str ());
304 304
305 // append content of line without trailing blanks 305 // append content of line without whitespace
306 int iLast = line.find_last_not_of (' '); 306 int last = line.find_last_not_of (" \t\f\v\r\n");
307 307
308 classpath.append (file_ops::tilde_expand (line.substr (0, iLast+1))); 308 classpath.append (file_ops::tilde_expand (line.substr (0, last+1)));
309 } 309 }
310 } 310 }
311 } 311 }
312 } 312 }
313 313
314 return (classpath); 314 return (classpath);
315 } 315 }
316
317 316
318 static std::string 317 static std::string
319 initial_class_path (void) 318 initial_class_path (void)
320 { 319 {
321 std::string java_dir = initial_java_dir (); 320 std::string java_dir = initial_java_dir ();