1
1
import 'dart:io' show File;
2
+ import 'package:corecoder_develop/modules/jsapi.dart' ;
2
3
import 'package:corecoder_develop/util/modules_manager.dart' ;
3
4
import 'package:flutter/material.dart' ;
5
+
6
+ import '../main.dart' ;
4
7
class CoreModule extends Module { //TODO doesnt work
5
8
6
9
@override
@@ -13,39 +16,43 @@ class CoreModule extends Module { //TODO doesnt work
13
16
null ,
14
17
"com.corecoder.coremodule" );
15
18
16
- Future <void > createSolution (String filepath, Map <String , dynamic > args, {String ? bpPath, String ? rpPath}) async {
17
- /// ---------------------------
18
- /// Create .ccsln.json file
19
- /// ---------------------------
20
- var obj = {
21
- "cc_version" : "0.0.1" ,
22
- "name" : "package name" ,
23
- "author" : "youre name" ,
24
- "description" : "package description" ,
25
- "identifier" : identifier,
26
- // must be unique to every module
27
- "folders" : {
28
- },
29
- "run_config" : [
30
- ]
31
- };
32
-
33
- // Write the file asynchronously
34
- var slnFile = File (filepath);
35
- await slnFile.create (recursive: true );
36
- await slnFile.writeAsString (ModulesManager .encoder.convert (obj));
37
- }
38
-
39
19
@override
40
20
void onInitialized (ModulesManager modulesManager, BuildContext buildContext) async {
41
21
super .onInitialized (modulesManager, buildContext);
42
22
var template = Template (
43
23
"Empty" , //title
44
- "Empty project" , //desc
24
+ "Empty project with no workspace plugins or files " , //desc
45
25
"" ,
46
- {},
26
+ {
27
+ "Project Name" : "String" ,
28
+ "Author" : "String" ,
29
+ },
47
30
(Map <String , dynamic > args) async {
48
31
//do absolutely nothing because this is empty
32
+ /// ---------------------------
33
+ /// Create .ccsln.json file
34
+ /// ---------------------------
35
+ var obj = {
36
+ "cc_version" : CoreCoderApp .version,
37
+ "name" : args["Project Name" ],
38
+ "author" : args["Author" ],
39
+ "description" : "" ,
40
+ "identifier" : identifier,
41
+ // must be unique to every module
42
+ "folders" : {
43
+ },
44
+ "run_config" : []
45
+ };
46
+ obj["folders" ]["Workspace" ] = "." ;
47
+
48
+
49
+ // Write the file asynchronously
50
+ var slnFilePath = CoreCoder .getProjectFolder ("core" , args["Project Name" ]) + "solution.ccsln.json" ;
51
+ var slnFile = File (slnFilePath);
52
+ await slnFile.create (recursive: true );
53
+ await slnFile.writeAsString (ModulesManager .encoder.convert (obj));
54
+ // Return the filepath so it loads the project automatically
55
+ return slnFilePath;
49
56
},
50
57
icon, "com.corecoder.empty" );
51
58
0 commit comments