11import 'dart:io' show File;
2+ import 'package:corecoder_develop/modules/jsapi.dart' ;
23import 'package:corecoder_develop/util/modules_manager.dart' ;
34import 'package:flutter/material.dart' ;
5+
6+ import '../main.dart' ;
47class CoreModule extends Module { //TODO doesnt work
58
69 @override
@@ -13,39 +16,43 @@ class CoreModule extends Module { //TODO doesnt work
1316 null ,
1417 "com.corecoder.coremodule" );
1518
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-
3919 @override
4020 void onInitialized (ModulesManager modulesManager, BuildContext buildContext) async {
4121 super .onInitialized (modulesManager, buildContext);
4222 var template = Template (
4323 "Empty" , //title
44- "Empty project" , //desc
24+ "Empty project with no workspace plugins or files " , //desc
4525 "" ,
46- {},
26+ {
27+ "Project Name" : "String" ,
28+ "Author" : "String" ,
29+ },
4730 (Map <String , dynamic > args) async {
4831 //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;
4956 },
5057 icon, "com.corecoder.empty" );
5158
0 commit comments