change working directories

This commit is contained in:
Linloir 2022-10-09 20:16:10 +08:00
parent 00fd34e0f1
commit 092a0cbb59
No known key found for this signature in database
GPG Key ID: 58EEB209A0F2C366
4 changed files with 7 additions and 5 deletions

View File

@ -1 +0,0 @@
27

Binary file not shown.

View File

@ -1,7 +1,7 @@
/* /*
* @Author : Linloir * @Author : Linloir
* @Date : 2022-10-06 15:44:16 * @Date : 2022-10-06 15:44:16
* @LastEditTime : 2022-10-09 18:00:40 * @LastEditTime : 2022-10-09 20:13:17
* @Description : * @Description :
*/ */
@ -15,8 +15,11 @@ import 'package:tcp_server/tcpcontroller/request.dart';
import 'package:tcp_server/tcpcontroller/response.dart'; import 'package:tcp_server/tcpcontroller/response.dart';
void main(List<String> arguments) async { void main(List<String> arguments) async {
//Create tmp folder //Create nessesary working directories
await Directory('${Directory.current.path}/.tmp').create(); await Directory('${Directory.current.path}/.tmp').create();
await Directory('${Directory.current.path}/.data').create();
await Directory('${Directory.current.path}/.data/files').create();
await DataBaseHelper().initialize(); await DataBaseHelper().initialize();
var tokenMap = <int, TCPController>{}; var tokenMap = <int, TCPController>{};
var controllerMap = <TCPController, Future<int>>{}; var controllerMap = <TCPController, Future<int>>{};

View File

@ -1,7 +1,7 @@
/* /*
* @Author : Linloir * @Author : Linloir
* @Date : 2022-10-06 16:15:01 * @Date : 2022-10-06 16:15:01
* @LastEditTime : 2022-10-09 17:59:13 * @LastEditTime : 2022-10-09 20:14:06
* @Description : * @Description :
*/ */
@ -480,7 +480,7 @@ class DataBaseHelper {
if(tempFile == null || fileMd5 == null) { if(tempFile == null || fileMd5 == null) {
throw Exception('Missing file parts'); throw Exception('Missing file parts');
} }
var filePath = '${Directory.current.path}\\$fileMd5'; var filePath = '${Directory.current.path}/.data/files/$fileMd5';
await tempFile.copy(filePath); await tempFile.copy(filePath);
tempFile.delete(); tempFile.delete();
try { try {