Exemplo n.º 1
0
nstr NSys::tempFilePath(const nstr& extension){
  NProgram::require();
  
  nstr p = _tempPath;
  
  nstr h = nstr::toStr(hash<NThread::id>()(NThread::thisThreadId()));
  
  double t = now();
  p += "/" + nstr::toStr(processId()) + "." + h + "." + nstr::toStr(t, false);
  
  if(!extension.empty()){
    p += "." + extension;
  }
  
  return p;
}
Exemplo n.º 2
0
  bool readLine(nstr& line){
    char* l = readline(first_ ? ">>> " : "");
    first_ = false;

    if(!l){
      done_ = true;
      return false;
    }
    
    line = l;
    line.strip();
    if(!line.empty()){
      add_history(l);
    }

    free(l);

    return true;
  }