Skip to content

Commit 8f5fe2b

Browse files
committed
fix: 优化获取 VSCode 是否为便携版的逻辑
- 修改获取 VSCODE_PORTABLE 环境变量的方式,确保其值为布尔类型以提高代码的可读性和可靠性。
1 parent cbcfc08 commit 8f5fe2b

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

README-CN.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ code --install-extension vscode-syncing
8080
- 🎉 初始版本发布
8181
- 支持设置和插件列表的同步
8282

83+
### 0.0.6
84+
85+
- fix: 优化获取 VSCode 是否为便携版的逻辑
86+
8387
---
8488

8589
## 📚 参考链接

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ The extension will automatically adapt to the remote server's file system and sy
7979
- 🎉 Initial release
8080
- Support for settings and extension sync
8181

82+
### 0.0.6
83+
84+
- fix: optimize logic for detecting whether VSCode is in portable mode
85+
- Updated the way the VSCODE_PORTABLE environment variable is checked to ensure it's evaluated as a boolean, improving code readability and reliability.
86+
8287
---
8388

8489
## 📚 References

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-syncing",
33
"displayName": "vscode-syncing",
44
"description": "vscode-syncing extension",
5-
"version": "0.0.5",
5+
"version": "0.0.6",
66
"publisher": "sunerpy",
77
"engines": {
88
"vscode": "^1.100.0"

src/dataCollector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class DataCollector {
1919
constructor(private outputChannel?: vscode.OutputChannel) {
2020
this.vscodeEdition = getVSCodeEdition();
2121
this.platform = getPlatform();
22-
this.isPortable = process.env.VSCODE_PORTABLE !== null;
22+
this.isPortable = !!process.env.VSCODE_PORTABLE;
2323
this.dataDirectory = getVSCodeDataDirectory();
2424
this.userDirectory = path.join(this.dataDirectory, "User");
2525
this.extensionsDirectory = getVSCodeExtensionsDirectory();

src/utils/vscodeEnvironment.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export function getPlatform(): Platform {
136136
* Gets the data directory of VSCode.
137137
*/
138138
export function getVSCodeDataDirectory(): string {
139-
const isPortable = process.env.VSCODE_PORTABLE !== null;
139+
const isPortable = !!process.env.VSCODE_PORTABLE;
140140
const platform = getPlatform();
141141
const edition = getVSCodeEdition();
142142

@@ -212,7 +212,7 @@ export function getVSCodeDataDirectory(): string {
212212
* Gets the extensions directory of VSCode.
213213
*/
214214
export function getVSCodeExtensionsDirectory(): string {
215-
const isPortable = process.env.VSCODE_PORTABLE !== null;
215+
const isPortable = !!process.env.VSCODE_PORTABLE;
216216
const edition = getVSCodeEdition();
217217

218218
if (isPortable) {

0 commit comments

Comments
 (0)