xref: /haiku/src/apps/haikudepot/util/StorageUtils.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2017-2020, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef PATH_UTILS_H
6 #define PATH_UTILS_H
7 
8 #include <Path.h>
9 
10 class StorageUtils {
11 
12 public:
13 	static bool				AreWorkingFilesAvailable();
14 	static void				SetWorkingFilesUnavailable();
15 
16 	static status_t			LocalWorkingFilesPath(const BString leaf,
17 								BPath& path,
18 								bool failOnCreateDirectory = true);
19 	static status_t			LocalWorkingDirectoryPath(const BString leaf,
20 								BPath& path,
21 								bool failOnCreateDirectory = true);
22 
23 	static status_t			CheckCanWriteTo(const BPath& path);
24 
25 	static status_t			RemoveDirectoryContents(BPath& path);
26 	static status_t			AppendToString(BPath& path, BString& result);
27 	static status_t			ExistsObject(const BPath& path,
28 								bool* exists,
29 								bool* isDirectory,
30 								off_t* size);
31 };
32 
33 #endif // PATH_UTILS_H
34