diff --git a/cli/src/connect/parser_executables.ts b/cli/src/connect/parser_executables.ts index a596917..12db999 100644 --- a/cli/src/connect/parser_executables.ts +++ b/cli/src/connect/parser_executables.ts @@ -19,6 +19,7 @@ import { getGradleWrapperPath, } from '../parser_scripts/get_gradlew_path' import { getComposeErrorSuggestion } from '../parser_scripts/compose_errors' +import { getCustomSwiftCLIPath } from '../parser_scripts/get_custom_swift_parse' const temporaryInputFilePath = 'tmp/figma-code-connect-parser-input.json.tmp' @@ -35,7 +36,8 @@ const FIRST_PARTY_PARSERS: Record = { swift: { command: async (cwd, config, mode) => { if (config.customSwiftCLIPath) { - return `${config.customSwiftCLIPath}` + const customCLIPath = path.join(getCustomSwiftCLIPath(cwd), `${config.customSwiftCLIPath}`) + return customCLIPath } else { return `swift run --package-path ${await getSwiftParserDir(cwd, (config as any).xcodeprojPath)} figma-swift` } diff --git a/cli/src/parser_scripts/get_custom_swift_parse.ts b/cli/src/parser_scripts/get_custom_swift_parse.ts new file mode 100644 index 0000000..98eb9d2 --- /dev/null +++ b/cli/src/parser_scripts/get_custom_swift_parse.ts @@ -0,0 +1,6 @@ +import { execSync } from 'child_process' + +// Check if a file matching a search pattern exists, and return the first match if so +export function getCustomSwiftCLIPath(cwd: string) { + return execSync(`pwd `, { cwd }).toString().trim().split('\n')[0] +}