bool flower_check_debug=false;
ofstream null_device ( "/dev/null");
-Dstream default_flower_stream(&null_device ,"/dev/null");
+Dstream default_flower_stream (&null_device ,"/dev/null");
Dstream *flower_dstream = &default_flower_stream;
/**
Set the debugging output. Will not delete/swallow argument.
*/
-void set_flower_debug(Dstream&ds, bool b)
+void set_flower_debug (Dstream&ds, bool b)
{
#ifdef NPRINT
if (b)
cout << "Debug printout disabled, see the installation guide." << endl;
#endif
+
flower_check_debug = b;
flower_dstream = &ds;
}
@return 4 components of the path. They can be empty
*/
void
-split_path(String path,
+split_path (String path,
String &drive, String &dirs, String &filebase, String &extension)
{
// peel off components, one by one.
- int di = path.index_i(':');
+ int di = path.index_i (':');
if (di >= 0)
{
- drive = path.left_str(di + 1);
- path = path.right_str(path.len() - di -1);
+ drive = path.left_str (di + 1);
+ path = path.right_str (path.len() - di -1);
}
else
drive = "";
- di = path.index_last_i(PATHSEP);
+ di = path.index_last_i (PATHSEP);
if (di >=0)
{
- dirs = path.left_str(di + 1);
- path = path.right_str(path.len()-di -1);
+ dirs = path.left_str (di + 1);
+ path = path.right_str (path.len()-di -1);
}
else
dirs = "";
- di = path.index_last_i('.');
+ di = path.index_last_i ('.');
if (di >= 0)
{
- filebase = path.left_str(di);
- extension =path.right_str(path.len()-di);
+ filebase = path.left_str (di);
+ extension =path.right_str (path.len()-di);
}
else
{
in any other added path, in this order.
*/
String
-File_path::find(String nm)const
+File_path::find (String nm)const
{
fdebug << "looking for " << nm << ": ";
- if ( !nm.length_i() || ( nm == "-" ) )
+ if ( !nm.length_i() || ( nm == "-") )
return nm;
for (int i=0; i < size(); i++) {
- String path = (*this)[i];
- path+= String(path.length_i()? "/":"")+nm;
+ String path = elem(i);
+ if ( path.length_i() )
+ path += "/";
+
+ path += nm;
fdebug << path << "? ";
- FILE *f = fopen(path.ch_C(), "r"); // ugh!
+ FILE *f = fopen (path.ch_C(), "r"); // ugh!
if (f) {
fdebug << "found\n";
- fclose(f);
+ fclose (f);
return path;
}
}