initial commit
This commit is contained in:
44
lib/models/project.dart
Normal file
44
lib/models/project.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:prod/models/editor.dart';
|
||||
import "dart:io";
|
||||
import "package:path/path.dart" as p;
|
||||
|
||||
class Project {
|
||||
final String name;
|
||||
final String language;
|
||||
final File path;
|
||||
final List<Editor> editors;
|
||||
final bool isGit;
|
||||
final bool enableTerminal;
|
||||
|
||||
Project(
|
||||
this.name,
|
||||
this.language,
|
||||
this.path,
|
||||
this.editors,
|
||||
this.isGit,
|
||||
this.enableTerminal,
|
||||
);
|
||||
|
||||
factory Project.validated(
|
||||
String name,
|
||||
String lang,
|
||||
String path,
|
||||
List<Editor> editors,
|
||||
bool enableTerminal,
|
||||
) {
|
||||
final File fpath = File(path);
|
||||
if (fpath.existsSync()) {
|
||||
print("Project not found!!!");
|
||||
} else {
|
||||
print("Project Exists on disk");
|
||||
}
|
||||
String gitPath = p.join(path, ".git", "HEAD");
|
||||
final bool isGit = File(gitPath).existsSync();
|
||||
|
||||
return Project(name, lang, fpath, editors, isGit, enableTerminal);
|
||||
}
|
||||
|
||||
// bool validatePath(){
|
||||
// return File
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user