Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit aca8b4d

Browse files
committedAug 11, 2024·
further windows path handling
1 parent 853b8ba commit aca8b4d

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed
 

‎script/texdoclib-search.tlu

+3-2
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,12 @@ function Doclist:add(df)
126126
-- if no realpath information, unable to add
127127
-- (useful if vanilla == false)
128128
if not df.realpath then return end
129+
local w32_path = texdoc.util.w32_path
129130
local df_hash = md5.sumhexa(df.normname:lower()):sub(1, 7) -- same as debug-score
130131

131132
-- check the existence of the file
132133
if not lfs.isfile(df.realpath) then
133-
dbg_print('search', '(%d) File %s not found. Skipping.', df_hash, df.realpath)
134+
dbg_print('search', '(%d) File %s not found. Skipping.', df_hash, w32_path(df.realpath))
134135
return
135136
end
136137

@@ -139,7 +140,7 @@ function Doclist:add(df)
139140
if index then
140141
self[index]:mergein(df)
141142
else
142-
dbg_print('search', '(%s) File %s found.', df_hash, df.realpath)
143+
dbg_print('search', '(%s) File %s found.', df_hash, w32_path(df.realpath))
143144
dbg_print_docfile(df, df_hash)
144145

145146
local newindex = #self + 1

‎spec/config/buitin_spec.rb

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
context "if no other sources of config is set" do
88
before(:each) { run_texdoc "-D", "texlive-en" }
99

10-
it "config items should be set to the default values" do
10+
it "should be set to the default values" do
1111
defaults = [
1212
"badext_list=txt, dat, ",
1313
"mode=view",
@@ -29,9 +29,5 @@
2929
debug_line "config", "Setting \"#{config}\" from built-in defaults.")
3030
end
3131
end
32-
33-
if not OS.windows?
34-
# nothing: just to prevent a bug on windows
35-
end
3632
end
3733
end

‎spec/search/alias_spec.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
EOF
1414
}
1515
before(:each) { File.write(texdoc_cnf, config_content) }
16+
let(:realpath) { Regexp.escape(normalize_path("texlive/texlive-en/texlive-en.pdf")) }
1617

1718
context "and query the exact alias" do
1819
before(:each) { run_texdoc "-ddocfile", "testalias" }
1920

2021
it "should find aliased documents" do
2122
expect(stderr).to include(debug_line "search", 'Searching documents for pattern "testalias"')
22-
expect(stderr).to match(/texdoc debug-search: \(0da8ec4\) File \S*texlive\/texlive-en\/texlive-en.pdf found/)
23+
expect(stderr).to match(/texdoc debug-search: \(0da8ec4\) File \S*#{realpath} found/)
2324
expect(stderr).to include(debug_line "docfile", "(0da8ec4) name: texlive/texlive-en/texlive-en.pdf")
2425
expect(stderr).to include(debug_line "docfile", "(0da8ec4) matches: texlive (alias)")
2526
expect(last_command_started).to be_successfully_executed
@@ -31,7 +32,7 @@
3132

3233
it "should not find aliased documents" do
3334
expect(stderr).to include(debug_line "search", 'Searching documents for pattern "testaliases"')
34-
expect(stderr).not_to match(/texdoc debug-search: \(0da8ec4\) File \S*texlive\/texlive-en\/texlive-en.pdf found/)
35+
expect(stderr).not_to match(/texdoc debug-search: \(0da8ec4\) File \S*#{realpath} found/)
3536
expect(stderr).not_to include(debug_line "docfile", "(0da8ec4) name: texlive/texlive-en/texlive-en.pdf")
3637
expect(stderr).not_to include(debug_line "docfile", "(0da8ec4) matches: texlive (alias)")
3738
end

0 commit comments

Comments
 (0)
Please sign in to comment.