* Create missing log and temproots directories automatically (reported
by Rob).
This commit is contained in:
		
							parent
							
								
									d1487d9015
								
							
						
					
					
						commit
						c6178f0b03
					
				
					 4 changed files with 25 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -271,6 +271,16 @@ Path createTempDir()
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void createDirs(const Path & path)
 | 
			
		||||
{
 | 
			
		||||
    if (path == "") return;
 | 
			
		||||
    createDirs(dirOf(path));
 | 
			
		||||
    if (!pathExists(path))
 | 
			
		||||
        if (mkdir(path.c_str(), 0777) == -1)
 | 
			
		||||
            throw SysError(format("creating directory `%1%'") % path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void writeStringToFile(const Path & path, const string & s)
 | 
			
		||||
{
 | 
			
		||||
    AutoCloseFD fd(open(path.c_str(),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -107,6 +107,9 @@ void makePathReadOnly(const Path & path);
 | 
			
		|||
/* Create a temporary directory. */
 | 
			
		||||
Path createTempDir();
 | 
			
		||||
 | 
			
		||||
/* Create a directory and all its parents, if necessary. */
 | 
			
		||||
void createDirs(const Path & path);
 | 
			
		||||
 | 
			
		||||
/* Create a file and write the given text to it.  The file is written
 | 
			
		||||
   in binary mode (i.e., no end-of-line conversions).  The path should
 | 
			
		||||
   not already exist. */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue