diff --git a/app/modules/library/sagas.js b/app/modules/library/sagas.js index 52a60d34..d7d6e777 100644 --- a/app/modules/library/sagas.js +++ b/app/modules/library/sagas.js @@ -17,6 +17,7 @@ /* eslint-disable no-constant-condition */ import * as actions from './actions'; +import * as pathlib from '@core/path'; import * as selectors from './selectors'; import { @@ -292,13 +293,23 @@ function* watchInstallLibrary() { let err, result = null; try { - let args = ['lib']; + let args = ['pkg', 'install']; + const isPlatformIOProject = storageDir + ? yield call(backendFetchData, { + query: 'os.is_file', + params: [pathlib.join(storageDir, 'platformio.ini')], + }) + : false; if (storageDir) { - args = args.concat(['--storage-dir', storageDir]); - } else { + args = args.concat([ + isPlatformIOProject ? '--project-dir' : '--storage-dir', + storageDir, + ]); + } + if (!isPlatformIOProject) { args.push('--global'); } - args = args.concat(['install', lib]); + args = args.concat(['--library', lib]); result = yield call(backendFetchData, { query: 'core.call', params: [args, { force_subprocess: true }], diff --git a/app/modules/platform/sagas.js b/app/modules/platform/sagas.js index 354a2d97..9a9c787d 100644 --- a/app/modules/platform/sagas.js +++ b/app/modules/platform/sagas.js @@ -290,7 +290,10 @@ function* watchInstallPlatform() { result = yield call(backendFetchData, { query: 'core.call', - params: [['platform', 'install', platform], { force_subprocess: true }], + params: [ + ['pkg', 'install', '--global', '--platform', platform], + { force_subprocess: true }, + ], }); ReactGA.timing({ diff --git a/app/modules/project/sagas.jsx b/app/modules/project/sagas.jsx index c41c121b..217f658b 100644 --- a/app/modules/project/sagas.jsx +++ b/app/modules/project/sagas.jsx @@ -444,7 +444,7 @@ function* watchSaveProjectConfig() { try { yield call(ensureUserConsent, PROJECT_CONFIG_SAVE_CONSENT_ID, { content: `Warning! - The entire file contents or platformio.ini will be rewritten with the current + The entire file contents of platformio.ini will be rewritten with the current configuration defined in this UI. Continue to save the configuration?`, okText: 'Save', diff --git a/package.json b/package.json index afea3965..c22b59ac 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "platformio-home", - "version": "3.4.1", + "version": "3.4.2", "description": "PlatformIO Home", "repository": { "type": "git",