Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'browser' help viewer for Windows #5515

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions lib/helpview.gi
Original file line number Diff line number Diff line change
Expand Up @@ -65,28 +65,26 @@
);


if ARCH_IS_WINDOWS() then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of unconditionally defining the code below, could we perhaps have a ARCH_IS_CYGWIN or so which does return true here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, forgot that such check exists. Makes perfect sense!

# html version on Windows
HELP_VIEWER_INFO.browser := rec(
type := "url",
show := function( filename )
local pos, winfilename;
if not StartsWith(filename, "/cygdrive") and
not StartsWith(filename, "/proc/cygdrive") then
Error( "the name of the help file ", filename , " must start with /cygdrive or /proc/cygdrive" );
else
# Ignoring part of the URL after '#' since we are unable
# to navigate to the precise location on Windows
winfilename:=MakeExternalFilename( SplitString( filename, "#" )[1] );
fi;
Print( "Opening help page ", winfilename, " in default windows browser ... \c" );
Exec( Concatenation("start ", winfilename ) );
Print( "done! \n" );
end
);
# html version on Windows
HELP_VIEWER_INFO.browser := rec(
type := "url",
show := function( filename )
local pos, winfilename;
# Ignoring part of the URL after '#' since we are unable
# to navigate to the precise location on Windows
winfilename:=MakeExternalFilename( SplitString( filename, "#" )[1] );
Print( "Opening help page ", winfilename, " in default windows browser ... \c" );
Process( DirectoryCurrent(),
Filename( DirectoriesSystemPrograms(), "cygstart.exe" ),
InputTextNone(),
OutputTextNone(),
[ winfilename ] );
Print( "done! \n" );

Check warning on line 82 in lib/helpview.gi

View check run for this annotation

Codecov / codecov/patch

lib/helpview.gi#L75-L82

Added lines #L75 - L82 were not covered by tests
end
);


elif ARCH_IS_MAC_OS_X() then
if ARCH_IS_MAC_OS_X() then
# html version using macOS default browser
HELP_VIEWER_INFO.("mac default browser") := rec (
type := "url",
Expand Down
Loading