From d42b68ac0121f6e6fcb09c900cf8c79bca718c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dolej=C5=A1=C3=AD?= Date: Thu, 7 May 2020 14:13:35 +0200 Subject: [PATCH] test for space escaping on MacOS (#62) * test for space escaping on MacOS * escaping path spaces on Mac * re-labeled View to Show Hierarchy * testing whether Parser file exists at the configured path - v2.17.3 --- .github/workflows/github-actions-vscode-extension.yml | 1 + CHANGELOG.md | 7 ++++++- package-lock.json | 2 +- package.json | 2 +- src/modelView/DomainTypesView.ts | 4 ++-- src/modelView/ProblemObjectsView.ts | 4 ++-- src/test/suite/ValDownload.test.ts | 9 +++++++++ src/test/suite/testUtils.ts | 5 ++++- src/validation/ValDownloader.ts | 8 +++++++- 9 files changed, 33 insertions(+), 9 deletions(-) diff --git a/.github/workflows/github-actions-vscode-extension.yml b/.github/workflows/github-actions-vscode-extension.yml index 518cc6f6..1ac5827c 100644 --- a/.github/workflows/github-actions-vscode-extension.yml +++ b/.github/workflows/github-actions-vscode-extension.yml @@ -15,6 +15,7 @@ jobs: matrix: node-version: [10.16] os: [windows-latest, macos-latest, ubuntu-latest] + # fail-fast: false runs-on: ${{ matrix.os }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e803492..e07a379e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # PDDL support - What's new? -## [2.17.2] +## 2.17.3 + +Escaping spaces in VAL paths on MacOS. +This is to fix [Issue 57](https://github.com/jan-dolejsi/vscode-pddl/issues/57). + +## 2.17.2 Added POPF `PlannerProvider`. Fixed default planner syntax to `$(planner) $(options) $(domain) $(problem)`. diff --git a/package-lock.json b/package-lock.json index 95a73c3a..4032c64f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "pddl", - "version": "2.17.2", + "version": "2.17.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6d016d4a..b74dc1e5 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Planning Domain Description Language support", "author": "Jan Dolejsi", "license": "MIT", - "version": "2.17.2", + "version": "2.17.3", "publisher": "jan-dolejsi", "engines": { "vscode": "^1.44.0", diff --git a/src/modelView/DomainTypesView.ts b/src/modelView/DomainTypesView.ts index ad595033..077bd557 100644 --- a/src/modelView/DomainTypesView.ts +++ b/src/modelView/DomainTypesView.ts @@ -77,11 +77,11 @@ export class DomainTypesView extends DomainView { expect(actualValStepPath).to.not.be.undefined; assert.startsWith(actualValueSeqPath!, path.join(valFolderPath, 'Val-20190911.1-win64'), "value seq path"); expect(askedToOverwrite).to.deep.equal(['ValStep']); + + const actualParserPath = conf.getParserPath(); + + if (actualParserPath.includes(' ') && os.platform() === 'darwin') { + expect(fs.existsSync(actualParserPath)).to.equal(true, `Parser at ${actualParserPath} should exist.`); + expect(actualParserPath).to.include('\ ', "spaces should be escaped by backslash"); + } } finally { const allStoredFiles = await utils.afs.getFiles(extensionContext.globalStoragePath); diff --git a/src/test/suite/testUtils.ts b/src/test/suite/testUtils.ts index 38bab1f7..10ff62e4 100644 --- a/src/test/suite/testUtils.ts +++ b/src/test/suite/testUtils.ts @@ -1,5 +1,6 @@ import * as assert from 'assert'; import * as path from 'path'; +import * as os from 'os'; import * as tmp from 'tmp-promise'; import { PddlExtensionContext, planner } from 'pddl-workspace'; import { Disposable, workspace, ExtensionContext, Memento, extensions, Event, FileType, Uri, ConfigurationTarget } from 'vscode'; @@ -50,7 +51,9 @@ class MockMemento implements Memento { export async function createTestExtensionContext(): Promise { const storage = await tmp.dir({ prefix: 'extensionTestStoragePath' }); - const globalStorage = await tmp.dir({ prefix: 'extensionGlobalTestStoragePath' }); + // simulate the space in the 'Application\ Support' on MacOS + const globalStoragePrefix = os.platform() === 'darwin' ? 'extensionGlobalTest StoragePath' : 'extensionGlobalTestStoragePath'; + const globalStorage = await tmp.dir({ prefix: globalStoragePrefix }); const log = await tmp.file({ mode: 0o644, prefix: 'extensionTests', postfix: 'log' }); return { diff --git a/src/validation/ValDownloader.ts b/src/validation/ValDownloader.ts index 90e6e57e..ae9eb503 100644 --- a/src/validation/ValDownloader.ts +++ b/src/validation/ValDownloader.ts @@ -7,6 +7,7 @@ import { ExtensionContext, window, ProgressLocation, workspace, ConfigurationTarget } from 'vscode'; import { instrumentOperationAsVsCodeCommand } from "vscode-extension-telemetry-wrapper"; import * as path from 'path'; +import * as os from 'os'; import { utils } from 'pddl-workspace'; import { ValDownloader as ValDownloaderBase, ValVersion, readValManifest, writeValManifest } from 'ai-planning-val'; import { PARSER_EXECUTABLE_OR_SERVICE, CONF_PDDL, VALIDATION_PATH, VALUE_SEQ_PATH, VAL_STEP_PATH, VALIDATOR_VERSION } from '../configuration/configuration'; @@ -190,7 +191,12 @@ export class ValDownloader extends ValDownloaderBase { } private normalizePathIfValid(pathToNormalize?: string): string | undefined { - return pathToNormalize ? path.normalize(pathToNormalize) : pathToNormalize; + if (!pathToNormalize) { return pathToNormalize; } + let normalizedPath = path.normalize(pathToNormalize); + if (os.platform() === 'darwin' && normalizedPath.includes(' ')) { + normalizedPath = normalizedPath.replace(' ', '\\ '); + } + return normalizedPath; } async isNewValVersionAvailable(): Promise {