Skip to content

Commit 9c462c0

Browse files
committed
chore: update CHANGELOG
1 parent aa4e8c8 commit 9c462c0

File tree

4 files changed

+59
-27
lines changed

4 files changed

+59
-27
lines changed

CHANGELOG.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
# Changelog
44

55
- [Changelog](#changelog)
6-
- [3.10.0](#3100)
6+
- [3.11.0](#3110)
77
- [New Features](#new-features)
88
- [Bug Fixes](#bug-fixes)
99
- [Documentation](#documentation)
1010
- [Development](#development)
11+
- [3.10.0](#3100)
12+
- [New Features](#new-features-1)
13+
- [Bug Fixes](#bug-fixes-1)
14+
- [Documentation](#documentation-1)
15+
- [Development](#development-1)
1116
- [Previous versions](#previous-versions)
1217

1318
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -47,6 +52,26 @@ VS Code v0.00.0
4752
4853
-->
4954

55+
## 3.11.0
56+
57+
VS Code v1.56
58+
59+
### New Features
60+
61+
- item
62+
63+
### Bug Fixes
64+
65+
- fix(socket): use xdgBasedir.runtime instead of tmp #3304 @jsjoeio
66+
67+
## Documentation
68+
69+
- item
70+
71+
## Development
72+
73+
- item
74+
5075
## 3.10.0
5176

5277
VS Code v1.56

src/node/socket.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class SocketProxyProvider {
7676
.then((pipe) => {
7777
this.proxyPipe = pipe
7878
return Promise.all([
79-
fs.mkdir(paths.runtime, { recursive: true }),
79+
fs.mkdir(path.dirname(this.proxyPipe), { recursive: true }),
8080
fs.rmdir(this.proxyPipe, { recursive: true }),
8181
])
8282
})

src/node/util.ts

+27-21
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ import * as os from "os"
77
import * as path from "path"
88
import * as util from "util"
99
import xdgBasedir from "xdg-basedir"
10-
import { tmpdir } from "./constants"
1110

12-
interface Paths {
11+
export interface Paths {
1312
data: string
1413
config: string
1514
runtime: string
@@ -23,26 +22,33 @@ export const paths = getEnvPaths()
2322
* ones. Most CLIs do this as in practice only GUI apps use the standard macOS directories.
2423
*/
2524
export function getEnvPaths(): Paths {
26-
let paths: Paths
27-
if (process.platform === "win32") {
28-
paths = {
29-
...envPaths("code-server", {
30-
suffix: "",
31-
}),
32-
runtime: tmpdir,
33-
}
34-
} else {
35-
if (xdgBasedir.data === undefined || xdgBasedir.config === undefined) {
36-
throw new Error("No home folder?")
37-
}
38-
paths = {
39-
data: path.join(xdgBasedir.data, "code-server"),
40-
config: path.join(xdgBasedir.config, "code-server"),
41-
runtime: xdgBasedir.runtime ? path.join(xdgBasedir.runtime, "code-server") : tmpdir,
42-
}
25+
const paths = envPaths("code-server", { suffix: "" })
26+
const append = (p: string): string => path.join(p, "code-server")
27+
switch (process.platform) {
28+
case "darwin":
29+
return {
30+
// envPaths uses native directories so force Darwin to use the XDG spec
31+
// to align with other CLI tools.
32+
data: xdgBasedir.data ? append(xdgBasedir.data) : paths.data,
33+
config: xdgBasedir.config ? append(xdgBasedir.config) : paths.config,
34+
// Fall back to temp if there is no runtime dir.
35+
runtime: xdgBasedir.runtime ? append(xdgBasedir.runtime) : paths.temp,
36+
}
37+
case "win32":
38+
return {
39+
data: paths.data,
40+
config: paths.config,
41+
// Windows doesn't have a runtime dir.
42+
runtime: paths.temp,
43+
}
44+
default:
45+
return {
46+
data: paths.data,
47+
config: paths.config,
48+
// Fall back to temp if there is no runtime dir.
49+
runtime: xdgBasedir.runtime ? append(xdgBasedir.runtime) : paths.temp,
50+
}
4351
}
44-
45-
return paths
4652
}
4753

4854
/**

test/unit/node/util.test.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { getEnvPaths } from "../../../src/node/util"
1+
import { getEnvPaths, Paths } from "../../../src/node/util"
22

33
describe("getEnvPaths", () => {
44
it("should return an object with the data, config and runtime path", () => {
55
const actualPaths = getEnvPaths()
6-
expect(actualPaths.hasOwnProperty("data")).toBe(true)
7-
expect(actualPaths.hasOwnProperty("config")).toBe(true)
8-
expect(actualPaths.hasOwnProperty("runtime")).toBe(true)
6+
const expectedProperties = ["data", "config", "runtime"]
7+
expectedProperties.forEach((property) => {
8+
expect(actualPaths[property as keyof Paths]).toBeDefined()
9+
})
910
})
1011
})

0 commit comments

Comments
 (0)