Skip to content

Commit

Permalink
Merge branch 'dev' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoonDorise committed Apr 6, 2024
2 parents 02a89b8 + b42ebaf commit 7330588
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 31 deletions.
41 changes: 23 additions & 18 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,24 +367,6 @@ ipcMain.on('emudeck', async (event, command) => {
bashCommand = command;
}

// Lets detect if the repo was cloned properly
if (fs.existsSync(allPath)) {
// file exists
} else {
event.reply(backChannel, 'nogit');
let bashCommand = `rm -rf ~/.config/EmuDeck/backend && mkdir -p ~/.config/EmuDeck/backend && git clone --no-single-branch --depth=1 https://github.com/dragoonDorise/EmuDeck.git ~/.config/EmuDeck/backend/ && cd ~/.config/EmuDeck/backend && git checkout master && touch ~/.config/EmuDeck/.cloned && printf "ec" && echo true`;

if (os.platform().includes('win32')) {
bashCommand = `cd %userprofile% && cd AppData && cd Roaming && cd EmuDeck && powershell -ExecutionPolicy Bypass -command "& { Start-Transcript "$env:USERPROFILE/EmuDeck/logs/pull.log"; git clone --no-single-branch --depth=1 https://github.com/EmuDeck/emudeck-we.git ./backend; Stop-Transcript"} && cd backend && git config user.email "[email protected]" && git config user.name "EmuDeck" && git checkout master && cd %userprofile% && if not exist emudeck mkdir emudeck && cd emudeck && CLS && echo true`;
}

return exec(`${bashCommand}`, shellType, (error, stdout, stderr) => {
// event.reply('console', { backChannel });
logCommand(bashCommand, error, stdout, stderr);
// mainWindow.reload();
});
}

let preCommand;

if (os.platform().includes('win32')) {
Expand Down Expand Up @@ -710,6 +692,29 @@ ipcMain.on('git-magic', async (event, branch) => {
.then((message = 'success'))
.catch((message = 'error'));
} else {
// Status Matrix Row Indexes (git reset)
const FILEPATH = 0;
const HEAD = 1;
const WORKDIR = 2;
const STAGE = 3;

// Status Matrix State
const UNCHANGED = 1;

const allFiles = await git.statusMatrix({ dir, fs });
// Get all files which have been modified or staged - does not include new untracked files or deleted files

const modifiedFiles = allFiles
.filter((row) => row[WORKDIR] > UNCHANGED && row[STAGE] > UNCHANGED)
.map((row) => row[FILEPATH]);

console.log({ modifiedFiles });

// Delete modified/staged files
await Promise.all(modifiedFiles.map((path) => fs.promises.rm(path)));

await git.checkout({ dir, fs, ref: branch, force: true });

await git
.pull({
fs,
Expand Down
15 changes: 2 additions & 13 deletions src/renderer/pages/CheckUpdatePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -468,19 +468,8 @@ function CheckUpdatePage() {
background...
</span>
),
body: <ProgressBar css="progress--success" infinite max="100" />,
footer: (
<BtnSimple
css="btn-simple--1"
type="button"
aria="Show log"
disabled={false}
style={{ marginBottom: 0 }}
onClick={() => showLog(system)}
>
See more details
</BtnSimple>
),
body: '',
footer: <ProgressBar css="progress--success" infinite max="100" />,
css: 'emumodal--xs emumodal--loading',
};

Expand Down

0 comments on commit 7330588

Please sign in to comment.