Skip to content

Commit 528828b

Browse files
committed
change ServerPathSeparator to be a getter function
1 parent 52d3a96 commit 528828b

5 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/webui/www/private/addtorrent.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<script defer src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
1212
<script defer src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
1313
<script defer src="scripts/lib/vanillaSelectBox.js"></script>
14+
<script defer src="scripts/cache.js?v=${CACHEID}"></script>
1415
<script defer src="scripts/localpreferences.js?v=${CACHEID}"></script>
1516
<script defer src="scripts/color-scheme.js?v=${CACHEID}"></script>
1617
<script defer src="scripts/addtorrent.js?locale=${LANG}&v=${CACHEID}"></script>

src/webui/www/private/rename_file.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta charset="UTF-8">
66
<title>QBT_TR(Renaming)QBT_TR[CONTEXT=TorrentContentTreeView]</title>
77
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css">
8+
<script defer src="scripts/cache.js?v=${CACHEID}"></script>
89
<script defer src="scripts/localpreferences.js?v=${CACHEID}"></script>
910
<script defer src="scripts/color-scheme.js?v=${CACHEID}"></script>
1011
<script defer src="scripts/filesystem.js?v=${CACHEID}"></script>

src/webui/www/private/rename_files.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<head>
55
<meta charset="UTF-8">
66
<title>QBT_TR(Renaming)QBT_TR[CONTEXT=TorrentContentTreeView]</title>
7+
<script defer src="scripts/cache.js?v=${CACHEID}"></script>
78
<script defer src="scripts/filesystem.js?v=${CACHEID}"></script>
89
<script defer src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
910
<script defer src="scripts/file-tree.js?v=${CACHEID}"></script>

src/webui/www/private/scripts/filesystem.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ window.qBittorrent.Filesystem ??= (() => {
3535
const exports = () => {
3636
return {
3737
PathSeparator: PathSeparator,
38-
ServerPathSeparator: ServerPathSeparator,
38+
getServerPathSeparator: getServerPathSeparator,
3939
fileExtension: fileExtension,
4040
fileName: fileName,
4141
folderName: folderName
@@ -44,12 +44,6 @@ window.qBittorrent.Filesystem ??= (() => {
4444

4545
const PathSeparator = "/";
4646

47-
/**
48-
* The native path separator used on the server
49-
*/
50-
const ServerPathSeparator = (window.qBittorrent?.Cache.buildInfo.get().platform === "windows")
51-
? "\\" : PathSeparator;
52-
5347
/**
5448
* Returns the file extension part of a file name.
5549
*/
@@ -74,6 +68,11 @@ window.qBittorrent.Filesystem ??= (() => {
7468
return filepath.substring(0, slashIndex);
7569
};
7670

71+
const getServerPathSeparator = () => {
72+
return (window.qBittorrent?.Cache?.buildInfo.get().platform === "windows")
73+
? "\\" : PathSeparator;
74+
}
75+
7776
return exports();
7877
})();
7978
Object.freeze(window.qBittorrent.Filesystem);

src/webui/www/private/scripts/torrent-content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ window.qBittorrent.TorrentContent ??= (() => {
485485
names.push(savePath);
486486
names.reverse();
487487

488-
files.push(names.join(window.qBittorrent.Filesystem.ServerPathSeparator));
488+
files.push(names.join(window.qBittorrent.Filesystem.getServerPathSeparator()));
489489
}
490490

491491
await clipboardCopy(files.join("\n"));

0 commit comments

Comments
 (0)