Skip to content

Commit

Permalink
Merge pull request #60 from Lenny4/dev
Browse files Browse the repository at this point in the history
deletes everything from the DeepFaceLabClient folder when i click Install in the Dashboard
  • Loading branch information
Lenny4 authored Jun 15, 2023
2 parents 31e4e8f + 1c00928 commit 1494517
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 15 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,25 @@

### Removed

## [0.1.2] - 2023-06-13

### Fixed

- Fix the bug on windows which erased DeepFaceLabClient when trying to install a release (/!\ the bug is still present in earlier versions)

## [0.1.1] - 2023-06-13

Note: on this version installing another release doesn't work (on windows), you need to install it manually from the github.

### Fixed

- Fix download Miniconda3-latest-Linux-x86_64.sh with no certificate


## [0.1.0] - 2023-06-12

Note: on this version installing another release doesn't work (on windows), you need to install it manually from the github.

### Added

- Install requirements (linux)
Expand Down
8 changes: 8 additions & 0 deletions lib/service/platform_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@ class PlatformService {
}
return Platform.environment[path] ?? Platform.pathSeparator;
}

static getReleaseFilename() {
var fileName = 'install_release.sh';
if (Platform.isWindows) {
fileName = 'install_release.bat';
}
return fileName;
}
}
9 changes: 6 additions & 3 deletions lib/widget/common/release_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:collection/collection.dart';
import 'package:deepfacelab_client/class/app_state.dart';
import 'package:deepfacelab_client/class/release.dart';
import 'package:deepfacelab_client/class/release_asset.dart';
import 'package:deepfacelab_client/service/platform_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
Expand Down Expand Up @@ -99,14 +100,16 @@ class ReleaseWidget extends HookWidget {
// region see .github/workflows/release.yml
var createdFolder = 'DeepFaceLabClient-linux';
var platform = 'linux';
var file = 'install_release.sh';
if (Platform.isWindows) {
createdFolder = 'DeepFaceLabClient-windows';
platform = 'windows';
file = 'install_release.bat';
}
var releaseFilename = PlatformService.getReleaseFilename();
var scriptFile = await File(
"${Directory.current.path}${Platform.pathSeparator}script${Platform.pathSeparator}$platform${Platform.pathSeparator}$releaseFilename")
.copy(folderPath + Platform.pathSeparator + releaseFilename);
Process.run(
"${Directory.current.path}${Platform.pathSeparator}script${Platform.pathSeparator}$platform${Platform.pathSeparator}$file",
scriptFile.path,
[
folderName,
folderPath,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.1.1
version: 0.1.2

environment:
sdk: '>=2.19.4 <3.0.0'
Expand Down
9 changes: 5 additions & 4 deletions script/linux/install_release.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
set -e

#just to be sure that DeepFaceLabClient is closed
sleep 2

folderName=$1
folderPath=$2
downloadFileName=$3
execPath=$4
createdFolder=$5

#just to be sure that DeepFaceLabClient is closed
sleep 2

rm -rf $folderPath/$folderName
unzip -o $folderPath/$downloadFileName -d $folderPath
#to preserve shortcut and symbolic link
mv $folderPath/$createdFolder $folderPath/$folderName
$execPath
rm $folderPath/$downloadFileName
$execPath & rm $folderPath/install_release.sh
16 changes: 9 additions & 7 deletions script/windows/install_release.bat
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
@echo off

@REM just to be sure that DeepFaceLabClient is closed
timeout 2

set folderName=%1
set folderPath=%2
set downloadFileName=%3
set execPath=%4
set createdFolder=%5

if exist %folderPath%\%folderName% rmdir %folderPath%\%folderName% /q /s
powershell -command "Start-Sleep -s 2"

tar -xf %folderPath%\%downloadFileName% -C %folderPath%
@REM to preserve shortcut and symbolic link
move %folderPath%\%createdFolder% %folderPath%\%folderName%
%execPath%
if %createdFolder% neq %folderName% (
xcopy %folderPath%\%createdFolder% %folderPath%\%folderName% /Y /S
rmdir /s /q %folderPath%\%createdFolder%
)
del %folderPath%\%downloadFileName%
start /b "" cmd /c %execPath% /b
start /b "" cmd /c del %folderPath%\install_release.bat&exit /b

0 comments on commit 1494517

Please sign in to comment.