|
1 | 1 | import 'dart:developer'; |
| 2 | +import 'dart:io'; |
2 | 3 |
|
3 | 4 | import 'package:logging/logging.dart'; |
4 | 5 | import 'package:path/path.dart' as p; |
@@ -79,6 +80,48 @@ void run(List<String> args) async { |
79 | 80 | await populateTestEnvironment(session); |
80 | 81 | } |
81 | 82 |
|
| 83 | + // Check if the storage directories exist, if not create them |
| 84 | + final storageDir = Directory('storage'); |
| 85 | + if (!await storageDir.exists()) { |
| 86 | + await storageDir.create(recursive: true); |
| 87 | + } |
| 88 | + |
| 89 | + final privateDir = Directory('storage/private'); |
| 90 | + if (!await privateDir.exists()) { |
| 91 | + await privateDir.create(recursive: true); |
| 92 | + } |
| 93 | + |
| 94 | + final publicDir = Directory('storage/public'); |
| 95 | + if (!await publicDir.exists()) { |
| 96 | + await publicDir.create(recursive: true); |
| 97 | + } |
| 98 | + |
| 99 | + // Create all private subdirectories |
| 100 | + final authsDir = Directory('storage/private/auths'); |
| 101 | + if (!await authsDir.exists()) { |
| 102 | + await authsDir.create(recursive: true); |
| 103 | + } |
| 104 | + |
| 105 | + final avatarsDir = Directory('storage/private/avatars'); |
| 106 | + if (!await avatarsDir.exists()) { |
| 107 | + await avatarsDir.create(recursive: true); |
| 108 | + } |
| 109 | + |
| 110 | + final documentsDir = Directory('storage/private/documents'); |
| 111 | + if (!await documentsDir.exists()) { |
| 112 | + await documentsDir.create(recursive: true); |
| 113 | + } |
| 114 | + |
| 115 | + final eventsDir = Directory('storage/private/events'); |
| 116 | + if (!await eventsDir.exists()) { |
| 117 | + await eventsDir.create(recursive: true); |
| 118 | + } |
| 119 | + |
| 120 | + final tempDir = Directory('storage/private/temp'); |
| 121 | + if (!await tempDir.exists()) { |
| 122 | + await tempDir.create(recursive: true); |
| 123 | + } |
| 124 | + |
82 | 125 | // TODO: uncomment in production |
83 | 126 | // Trigger the backup future call to generate database backups. |
84 | 127 | // It will be triggered right away and after that it will recall itself every day at 2 AM. |
|
0 commit comments