Skip to content

Commit

Permalink
fix: issues with windows paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Turtlepaw committed Feb 6, 2025
1 parent 998477a commit ba6ac61
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clockwork",
"version": "1.1.6",
"version": "1.1.6-fix.1",
"main": "scripts/build.js",
"repository": "https://github.com/turtlepaw/clockwork.git",
"author": "https://github.com/turtlepaw",
Expand Down Expand Up @@ -47,4 +47,4 @@
"node_modules/ora/**"
]
}
}
}
21 changes: 12 additions & 9 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from "./utils";
import { getPackages, readPackageFile } from "./package";
import { downloadFile, executeCommand } from "./command";
import "./extensions";

// get version from package.json
const VERSION = "__VERSION__";
Expand Down Expand Up @@ -217,7 +218,7 @@ export default async function main() {
const spinner = await progressIndicator("Validating...");
try {
const javaPath = path.join(env.JAVA_HOME!, "bin", "java");
const result = await executeCommand(javaPath, [
const result = await executeCommand(javaPath.surround('"'), [
"-jar",
`"${validatorJar}"`,
packageFile.watchFaceFormatVersion ?? "2",
Expand Down Expand Up @@ -303,7 +304,7 @@ export default async function main() {

try {
const javaPath = path.join(env.JAVA_HOME!, "bin", "java");
await executeCommand(javaPath, [
await executeCommand(javaPath.surround('"'), [
"-jar",
`"${memoryTool}"`,
"--watch-face",
Expand Down Expand Up @@ -347,7 +348,7 @@ export default async function main() {
} | null> {
try {
const model = (
await executeCommand(adbExe, [
await executeCommand(adbExe.surround('"'), [
"-s",
deviceId,
"shell",
Expand All @@ -359,7 +360,7 @@ export default async function main() {
.trim();

const characteristics = (
await executeCommand(adbExe, [
await executeCommand(adbExe.surround('"'), [
"-s",
deviceId,
"shell",
Expand All @@ -371,7 +372,7 @@ export default async function main() {
.trim();

const osVersion = (
await executeCommand(adbExe, [
await executeCommand(adbExe.surround('"'), [
"-s",
deviceId,
"shell",
Expand All @@ -383,7 +384,7 @@ export default async function main() {
.trim();

const apiLevel = (
await executeCommand(adbExe, [
await executeCommand(adbExe.surround('"'), [
"-s",
deviceId,
"shell",
Expand Down Expand Up @@ -411,7 +412,9 @@ export default async function main() {

// Installation
const spinner = await progressIndicator("Installing...");
const devicesResult = (await executeCommand(adbExe, ["devices"])).stdout
const devicesResult = (
await executeCommand(adbExe.surround('"'), ["devices"])
).stdout
.toString()
.trim()
.split("\n")
Expand Down Expand Up @@ -479,13 +482,13 @@ export default async function main() {
}

try {
await executeCommand(adbExe, [
await executeCommand(adbExe.surround('"'), [
"-s",
targetDevice,
"install",
"watchface/build/outputs/apk/debug/watchface-debug.apk",
]);
await executeCommand(adbExe, [
await executeCommand(adbExe.surround('"'), [
"-s",
targetDevice,
"shell",
Expand Down
11 changes: 11 additions & 0 deletions scripts/extensions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
declare global {
interface String {
surround(character: string): string;
}
}

String.prototype.surround = function (character: string): string {
return `${character}${this}${character}`;
};

export {};

0 comments on commit ba6ac61

Please sign in to comment.