Skip to content

Commit 33cd7ac

Browse files
committed
Merge branch 'rename-win-shortcuts'
2 parents 01102af + 53ad0f1 commit 33cd7ac

21 files changed

+55
-48
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ Line wrap the file at 100 chars. Th
2222
* **Security**: in case of vulnerabilities.
2323

2424
## [Unreleased]
25+
### Changed
26+
#### Windows
27+
- Rename `win-shortcuts` native module to `windows-utils`.
28+
2529
### Removed
2630
- Remove "Any" option for tunnel protocol. The default is now WireGuard.
2731

Cargo.lock

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ resolver = "2"
1111
members = [
1212
"android/translations-converter",
1313
"desktop/packages/nseventforwarder",
14-
"desktop/packages/win-shortcuts",
14+
"desktop/packages/windows-utils",
1515
"mullvad-api",
1616
"mullvad-cli",
1717
"mullvad-daemon",

desktop/package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

desktop/packages/mullvad-vpn/gulpfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ task(
4141
'clean',
4242
'set-dev-env',
4343
scripts.buildNseventforwarder,
44-
scripts.buildWinShortcuts,
44+
scripts.buildWindowsUtils,
4545
watch.start,
4646
),
4747
);

desktop/packages/mullvad-vpn/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"simple-plist": "^1.3.1",
2929
"sprintf-js": "^1.1.2",
3030
"styled-components": "^6.1.13",
31-
"win-shortcuts": "0.0.0"
31+
"windows-utils": "0.0.0"
3232
},
3333
"devDependencies": {
3434
"@playwright/test": "^1.41.1",

desktop/packages/mullvad-vpn/src/main/windows-split-tunneling.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { app } from 'electron';
22
import fs from 'fs';
33
import path from 'path';
4-
import { readShortcut } from 'win-shortcuts';
4+
import { readShortcut } from 'windows-utils';
55

66
import {
77
ISplitTunnelingApplication,

desktop/packages/mullvad-vpn/tasks/distribution.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function newConfig() {
5757
'!node_modules/grpc-tools',
5858
'!node_modules/@types',
5959
'!node_modules/nseventforwarder/debug',
60-
'!node_modules/win-shortcuts/debug',
60+
'!node_modules/windows-utils/debug',
6161
],
6262

6363
// Make sure that all files declared in "extraResources" exists and abort if they don't.
@@ -291,15 +291,15 @@ async function packWin() {
291291
process.env.TARGET_SUBDIR = 'x86_64-pc-windows-msvc';
292292
process.env.DIST_SUBDIR = '';
293293

294-
execFileSync('npm', ['-w', 'win-shortcuts', 'run', 'build-x86'], { shell: true });
294+
execFileSync('npm', ['-w', 'windows-utils', 'run', 'build-x86'], { shell: true });
295295
break;
296296
case 'arm64':
297297
process.env.TARGET_TRIPLE = 'aarch64-pc-windows-msvc';
298298
process.env.SETUP_SUBDIR = 'aarch64-pc-windows-msvc';
299299
process.env.TARGET_SUBDIR = 'aarch64-pc-windows-msvc';
300300
process.env.DIST_SUBDIR = 'aarch64-pc-windows-msvc';
301301

302-
execFileSync('npm', ['-w', 'win-shortcuts', 'run', 'build-arm'], { shell: true });
302+
execFileSync('npm', ['-w', 'windows-utils', 'run', 'build-arm'], { shell: true });
303303
break;
304304
default:
305305
throw new Error('Invalid or unknown target (only one may be specified)');

desktop/packages/mullvad-vpn/tasks/scripts.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,22 @@ function buildNseventforwarder(callback) {
117117
}
118118
}
119119

120-
function buildWinShortcuts(callback) {
120+
function buildWindowsUtils(callback) {
121121
if (process.platform === 'win32') {
122-
exec('npm -w win-shortcuts run build-debug', (err) => callback(err));
122+
exec('npm -w windows-utils run build-debug', (err) => callback(err));
123123
} else {
124124
callback();
125125
}
126126
}
127127

128128
compileScripts.displayName = 'compile-scripts';
129129
buildNseventforwarder.displayName = 'build-nseventforwarder';
130-
buildWinShortcuts.displayName = 'build-win-shortcuts';
130+
buildWindowsUtils.displayName = 'build-windows-utils';
131131

132132
exports.build = series(
133133
compileScripts,
134134
parallel(makeBrowserifyPreload(false), makeBrowserifyRenderer(false)),
135135
);
136136
exports.buildNseventforwarder = buildNseventforwarder;
137-
exports.buildWinShortcuts = buildWinShortcuts;
137+
exports.buildWindowsUtils = buildWindowsUtils;
138138
exports.makeWatchCompiler = makeWatchCompiler;

desktop/packages/mullvad-vpn/vite.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const viteConfig = defineConfig({
7474
// Packages in workspace which exports common js
7575
/management-interface/,
7676
/nseventforwarder/,
77-
/win-shortcuts/,
77+
/windows-utils/,
7878
// External dependencies which exports common js
7979
/node_modules/,
8080
],
@@ -87,7 +87,7 @@ const viteConfig = defineConfig({
8787
},
8888
external: [
8989
// Packages in workspace which can not be bundled
90-
'win-shortcuts',
90+
'windows-utils',
9191
// External dependencies
9292
'@grpc/grpc-js',
9393
'google-protobuf',

desktop/packages/win-shortcuts/Cargo.toml desktop/packages/windows-utils/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "win-shortcuts"
2+
name = "windows-utils"
33
description = ""
44
authors.workspace = true
55
repository.workspace = true
@@ -13,7 +13,7 @@ workspace = true
1313

1414
[lib]
1515
crate-type = ["cdylib"]
16-
path = "win-shortcuts-rs/lib.rs"
16+
path = "windows-utils-rs/lib.rs"
1717

1818
[target.'cfg(target_os = "windows")'.dependencies]
1919
neon = "1"

desktop/packages/win-shortcuts/README.md desktop/packages/windows-utils/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# win-shortcuts
1+
# windows-utils
22

3-
## Building win-shortcuts
3+
## Building windows-utils
44

5-
Building win-shortcuts requires a [supported version of Node and Rust](https://github.com/neon-bindings/neon#platform-support).
5+
Building windows-utils requires a [supported version of Node and Rust](https://github.com/neon-bindings/neon#platform-support).
66

77
To run the build, run:
88

desktop/packages/win-shortcuts/package.json desktop/packages/windows-utils/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"name": "win-shortcuts",
2+
"name": "windows-utils",
33
"version": "0.0.0",
44
"author": "Mullvad VPN",
55
"license": "GPL-3.0",
66
"description": "",
77
"main": "./lib/index.cjs",
88
"scripts": {
99
"cargo-build": "npm run build-typescript && cargo build",
10-
"build-debug": "npm run cargo-build && (test -d debug || mkdir debug) && cp ../../../target/debug/win_shortcuts.dll debug/index.node",
11-
"build-arm": "npm run cargo-build -- --release --target aarch64-pc-windows-msvc && (test -d dist || mkdir dist) && (test -d dist/win32-arm64-msvc || mkdir \"dist/win32-arm64-msvc\") && cp ../../../target/aarch64-pc-windows-msvc/release/win_shortcuts.dll dist/win32-arm64-msvc/index.node",
10+
"build-debug": "npm run cargo-build && (test -d debug || mkdir debug) && cp ../../../target/debug/windows_utils.dll debug/index.node",
11+
"build-arm": "npm run cargo-build -- --release --target aarch64-pc-windows-msvc && (test -d dist || mkdir dist) && (test -d dist/win32-arm64-msvc || mkdir \"dist/win32-arm64-msvc\") && cp ../../../target/aarch64-pc-windows-msvc/release/windows_utils.dll dist/win32-arm64-msvc/index.node",
1212
"build-typescript": "tsc",
13-
"build-x86": "npm run cargo-build -- --release --target x86_64-pc-windows-msvc && (test -d dist || mkdir dist) && (test -d dist/win32-x64-msvc || mkdir \"dist/win32-x64-msvc\") && cp ../../../target/x86_64-pc-windows-msvc/release/win_shortcuts.dll dist/win32-x64-msvc/index.node",
13+
"build-x86": "npm run cargo-build -- --release --target x86_64-pc-windows-msvc && (test -d dist || mkdir dist) && (test -d dist/win32-x64-msvc || mkdir \"dist/win32-x64-msvc\") && cp ../../../target/x86_64-pc-windows-msvc/release/windows_utils.dll dist/win32-x64-msvc/index.node",
1414
"clean": "rm -rf debug; rm -rf dist",
1515
"lint": "eslint .",
1616
"lint-fix": "eslint --fix .",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![cfg(target_os = "windows")]
2+
3+
use neon::{prelude::ModuleContext, result::NeonResult};
4+
5+
mod shortcut;
6+
7+
#[neon::main]
8+
fn main(mut cx: ModuleContext<'_>) -> NeonResult<()> {
9+
cx.export_function("readShortcut", shortcut::read_shortcut)?;
10+
11+
Ok(())
12+
}

desktop/packages/win-shortcuts/win-shortcuts-rs/lib.rs desktop/packages/windows-utils/windows-utils-rs/shortcut.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![cfg(target_os = "windows")]
2-
31
use std::marker::PhantomData;
42
use std::string::FromUtf16Error;
53
use std::sync::{mpsc, OnceLock};
@@ -51,14 +49,7 @@ enum Error {
5149
/// 32 KiB: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
5250
const MAX_PATH_LEN: usize = 0x7fff;
5351

54-
#[neon::main]
55-
fn main(mut cx: ModuleContext<'_>) -> NeonResult<()> {
56-
cx.export_function("readShortcut", read_shortcut)?;
57-
58-
Ok(())
59-
}
60-
61-
fn read_shortcut(mut cx: FunctionContext<'_>) -> JsResult<'_, JsValue> {
52+
pub fn read_shortcut(mut cx: FunctionContext<'_>) -> JsResult<'_, JsValue> {
6253
let link_path = cx.argument::<JsString>(0)?.value(&mut cx);
6354

6455
match read_shortcut_inner(link_path) {

0 commit comments

Comments
 (0)