1 /* 2 * Copyright 2015, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 //! Empty main temporary directory 8 9 10 #include "InitTemporaryDirectoryJob.h" 11 12 #include <FindDirectory.h> 13 #include <Path.h> 14 15 InitTemporaryDirectoryJob()16InitTemporaryDirectoryJob::InitTemporaryDirectoryJob() 17 : 18 AbstractEmptyDirectoryJob("init /tmp") 19 { 20 } 21 22 23 status_t Execute()24InitTemporaryDirectoryJob::Execute() 25 { 26 // TODO: the /tmp entries could be scanned synchronously, and deleted 27 // later 28 BPath path; 29 status_t status = find_directory(B_SYSTEM_TEMP_DIRECTORY, &path, true); 30 if (status == B_OK) 31 status = CreateAndEmpty(path.Path()); 32 33 chmod(path.Path(), 0777); 34 return status; 35 } 36