Skip to content

Commit d57d87e

Browse files
committed
dart: add function to create dir for specified file
1 parent b341ad6 commit d57d87e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/util/fs.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@ Future<void> fsUnzipFiles(String zipFilename, String dstDir) async {
166166
}
167167
}
168168

169+
Future<void> fsGuaranteeDir(String filename) async {
170+
final dir = Directory(path.dirname(filename));
171+
if (!dir.existsSync()) {
172+
dir.create(recursive: true);
173+
}
174+
}
175+
169176
Future<void> fsDownload(String filename, String url) async {
170177
var urlobj = Uri.parse(url);
171178
var client = HttpClient();

0 commit comments

Comments
 (0)