Skip to content

Commit

Permalink
update solo-mode bin / path
Browse files Browse the repository at this point in the history
  • Loading branch information
fcannizzaro committed Jan 21, 2024
1 parent 6156acc commit b18c787
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 24 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build-rust-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ jobs:
command: build
args: --manifest-path solo-mode/Cargo.toml --release

- name: Temporary store install-sd-solo-enabler.exe
- name: Temporary store install-sd-solo-mode.exe
uses: actions/upload-artifact@v3
with:
name: service-installer
path: ./solo-mode/target/release/install-sd-solo-enabler.exe
path: ./solo-mode/target/release/install-sd-solo-mode.exe
retention-days: 365

- name: Temporary store remove-sd-solo-enabler.exe
- name: Temporary store remove-sd-solo-mode.exe
uses: actions/upload-artifact@v3
with:
name: service-remover
path: ./solo-mode/target/release/remove-sd-solo-enabler.exe
path: ./solo-mode/target/release/remove-sd-solo-mode.exe
retention-days: 365

- name: Temporary store sd-solo-enabler.exe
- name: Temporary store sd-solo-mode.exe
uses: actions/upload-artifact@v3
with:
name: service
path: ./solo-mode/target/release/sd-solo-enabler.exe
path: ./solo-mode/target/release/sd-solo-mode.exe
retention-days: 365

build-macro-windows:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ jobs:
run: |
mkdir -p plugin/com.dim.streamdeck.sdPlugin/solo-mode
mkdir -p plugin/com.dim.streamdeck.sdPlugin/macro
mv service-installer/install-sd-solo-enabler.exe plugin/com.dim.streamdeck.sdPlugin/solo-mode/
mv service-remover/remove-sd-solo-enabler.exe plugin/com.dim.streamdeck.sdPlugin/solo-mode/
mv service/sd-solo-enabler.exe plugin/com.dim.streamdeck.sdPlugin/solo-mode/
mv service-installer/install-sd-solo-mode.exe plugin/com.dim.streamdeck.sdPlugin/solo-mode/
mv service-remover/remove-sd-solo-mode.exe plugin/com.dim.streamdeck.sdPlugin/solo-mode/
mv service/sd-solo-mode.exe plugin/com.dim.streamdeck.sdPlugin/solo-mode/
mv macro/macro.exe plugin/com.dim.streamdeck.sdPlugin/macro/macro.exe
- name: Build plugin
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"node_modules": true
},
"cSpell.words": [
"advfirewall",
"aeeidfelonceeehdppacnjlimhoneige",
"APPDATA",
"bungify",
Expand All @@ -22,10 +23,13 @@
"destinyitemmanager",
"enigo",
"msedge",
"netsh",
"onwarn",
"perkname",
"pixmap",
"randomroll",
"remoteport",
"rouille",
"singlefile",
"typer"
]
Expand Down
8 changes: 4 additions & 4 deletions plugin/src/actions/solo-mode/solo-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { exec } from "child_process";
import { checkInstalledService } from "./service";
import { KeyDown, WillAppear } from "@/settings";
import { log } from "@/util/logger";
import fs from "fs/promises";
import { join } from "path";
import { existsSync } from "fs";
import { copyFile } from "fs/promises";

interface PropertyInspectorData {
action: "remove-service" | "install-service";
Expand Down Expand Up @@ -50,15 +50,15 @@ export class SoloMode extends SingletonAction {
e.payload.action === "install-service" ? "install" : "remove";

// calc the service path outside the plugin directory (to avoid issues on update)
const servicePath = join(process.env.APPDATA!, "./sd-solo-enabler.exe");
const servicePath = join(process.env.APPDATA!, "./sd-solo-mode.exe");

// copy the service if it doesn't exist
if (!existsSync(servicePath)) {
fs.copyFile("./solo-mode/sd-solo-enabler.exe", servicePath);
await copyFile("./solo-mode/sd-solo-mode.exe", servicePath);
}

// run the installer/remover
const p = exec(`start ./solo-mode/${prefix}-sd-solo-enabler.exe`);
const p = exec(`start ./solo-mode/${prefix}-sd-solo-mode.exe`);

// verify and update the global settings
p.on("exit", () =>
Expand Down
6 changes: 3 additions & 3 deletions solo-mode/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ lto = true
codegen-units = 1

[[bin]]
name = "sd-solo-enabler"
name = "sd-solo-mode"
path = "src/main.rs"


[[bin]]
name = "install-sd-solo-enabler"
name = "install-sd-solo-mode"
path = "src/install.rs"

[[bin]]
name = "remove-sd-solo-enabler"
name = "remove-sd-solo-mode"
path = "src/remove.rs"
8 changes: 4 additions & 4 deletions solo-mode/build.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fn main() {
#[cfg(windows)]
{
println!("cargo:rustc-link-arg-bin=remove-sd-solo-enabler=/MANIFEST:EMBED");
println!("cargo:rustc-link-arg-bin=remove-sd-solo-enabler=/MANIFESTUAC:level=\'requireAdministrator\'");
println!("cargo:rustc-link-arg-bin=install-sd-solo-enabler=/MANIFEST:EMBED");
println!("cargo:rustc-link-arg-bin=install-sd-solo-enabler=/MANIFESTUAC:level=\'requireAdministrator\'");
println!("cargo:rustc-link-arg-bin=remove-sd-solo-mode=/MANIFEST:EMBED");
println!("cargo:rustc-link-arg-bin=remove-sd-solo-mode=/MANIFESTUAC:level=\'requireAdministrator\'");
println!("cargo:rustc-link-arg-bin=install-sd-solo-mode=/MANIFEST:EMBED");
println!("cargo:rustc-link-arg-bin=install-sd-solo-mode=/MANIFESTUAC:level=\'requireAdministrator\'");
}
}
11 changes: 7 additions & 4 deletions solo-mode/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ fn main() -> windows_service::Result<()> {
service_manager::{ServiceManager, ServiceManagerAccess},
};

let mut service_binary_path = dirs::config_dir().unwrap();

service_binary_path.push("sd-solo-mode.exe");

let manager_access = ServiceManagerAccess::CONNECT | ServiceManagerAccess::CREATE_SERVICE;
let service_manager = ServiceManager::local_computer(None::<&str>, manager_access)?;
let service_manager: ServiceManager =
ServiceManager::local_computer(None::<&str>, manager_access)?;

let service_binary_path = dirs::config_dir()
.unwrap()
.with_file_name("sd-solo-enabler.exe");
print!("Destiny 2 Solo Enabler > installing service... ");

let service_info = ServiceInfo {
name: OsString::from("sd_solo_enabler"),
Expand Down

0 comments on commit b18c787

Please sign in to comment.