checkServeShouldRefresh function

bool checkServeShouldRefresh(
  1. String timestampPath
)

Implementation

bool checkServeShouldRefresh(String timestampPath) {
  String servePath = fs.path.join(userRootPath(), 'bin', 'server.tar.gz');
  File timestampFile = fs.file(timestampPath);
  DateTime time = fs.file(servePath).lastModifiedSync();
  String serveTimeValue = time.millisecondsSinceEpoch.toString();
  if (!timestampFile.existsSync()) {
    return true;
  } else {
    String timestampContent = timestampFile.readAsStringSync();
    if (int.parse(serveTimeValue) > int.parse(timestampContent)) {
      return true;
    }
  }
  return false;
}