45 lines
915 B
Dart
45 lines
915 B
Dart
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
|
|
// }
|
|
}
|