Skip to content

Commit 5750a3b

Browse files
committed
fix(files): Files not showing in paths with capital letters
1 parent 4577ea9 commit 5750a3b

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

src/dialog_launcher.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,11 @@ export class Launcher extends search.Search {
4545
return this.options
4646
}
4747

48-
const pattern = pat.toLowerCase()
49-
5048
this.last_plugin = null
5149

5250
let windows = new Array()
5351

54-
this.service.query(ext, pattern, (plugin, response) => {
52+
this.service.query(ext, pat, (plugin, response) => {
5553
if (response.event === "queried") {
5654
for (const selection of response.selections) {
5755
if (!this.last_plugin) this.last_plugin = plugin;
@@ -77,6 +75,8 @@ export class Launcher extends search.Search {
7775
}
7876
})
7977

78+
const pattern = pat.toLowerCase()
79+
8080
const needles = pattern.split(' ');
8181

8282
const contains_pattern = (haystack: string, needles: Array<string>): boolean => {

src/launcher_service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ export class LauncherService {
9191
}
9292

9393
private register_plugin_directory(directory: string) {
94-
global.log(`checking for plugins in ${directory}`)
9594
let dir = Gio.file_new_for_path(directory)
9695
if (!dir.query_exists(null)) return
9796

src/plugins/files/main.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class App {
2626
constructor() {
2727
/** @type Array<Selection> */
2828
this.selections = new Array()
29-
29+
3030
/** @type string */
3131
this.parent = ""
3232

@@ -52,21 +52,27 @@ class App {
5252

5353
/**
5454
* Queries the plugin for results from this input
55-
*
56-
* @param {string} input
55+
*
56+
* @param {string} input
5757
*/
5858
query(input) {
5959
if (input.startsWith('~')) {
6060
input = GLib.get_home_dir() + input.substr(1)
6161
}
6262

6363
this.last_query = input
64+
65+
// Add `/` to query if the input is a directory
66+
this.last_query = (!input.endsWith('/') && Gio.file_new_for_path(input).query_file_type(0, null) === 2)
67+
? input + '/'
68+
: input
69+
6470
this.selections.splice(0)
65-
this.parent = GLib.path_get_dirname(input)
71+
this.parent = GLib.path_get_dirname(this.last_query)
6672

6773
/** @type string */
68-
let base = GLib.path_get_basename(input)
69-
74+
let base = GLib.path_get_basename(this.last_query)
75+
7076
const show_hidden = base.startsWith('.')
7177

7278
if (this.parent.endsWith(base)) base = ""
@@ -85,7 +91,7 @@ class App {
8591
continue
8692
}
8793

88-
if (!show_hidden && name.startsWith('.')) continue
94+
if (!show_hidden && name.startsWith('.')) continue
8995

9096
const content_type = entry.get_content_type()
9197
const directory = entry.get_file_type() === 2
@@ -106,7 +112,7 @@ class App {
106112
const a_name = a.name.toLowerCase()
107113
const b_name = b.name.toLowerCase()
108114

109-
const pattern_lower = input.toLowerCase()
115+
const pattern_lower = this.last_query.toLowerCase()
110116

111117
const a_includes = a_name.includes(pattern_lower)
112118
const b_includes = b_name.includes(pattern_lower)
@@ -133,7 +139,7 @@ class App {
133139

134140
/**
135141
* Applies an option that the user selected
136-
*
142+
*
137143
* @param {number} id
138144
*/
139145
submit(id) {
@@ -153,17 +159,17 @@ class App {
153159

154160
/**
155161
* Sends message back to Pop Shell
156-
*
157-
* @param {Object} object
162+
*
163+
* @param {Object} object
158164
*/
159165
send(object) {
160166
STDOUT.write_bytes(new GLib.Bytes(JSON.stringify(object) + "\n"), null)
161167
}
162168
}
163169

164170
/**
165-
*
166-
* @param {string} parent
171+
*
172+
* @param {string} parent
167173
* @param {Selection} selection
168174
* @returns {string}
169175
*/

0 commit comments

Comments
 (0)