-
Notifications
You must be signed in to change notification settings - Fork 911
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
Accept a cfg as an argument as an alt way to start the viewer #632
Conversation
Thanks. This looks nice. Just two things:
|
Thank you for the review! Sorry for the late response.
|
I think mingw makes sure that
I'm fairly sure you always get an absolute path in those cases. A relative path is too risky in those cases. |
Seems like you are indeed right, from my own manual testing. Working on setting up the mingw environment, unfortunately long since I last used it so I need to read up a bit, sorry for the delays! |
18fd052
to
5818dad
Compare
@CendioOssman: Managed to setup mingw, attempted to address the issues you pointed out, please see the amended commit. |
vncviewer/vncviewer.cxx
Outdated
#else | ||
const bool absolute = vncServerName[0] == '\\' || vncServerName[1] == ':'; | ||
#endif | ||
if (!absolute && vncServerName[0] != '.') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can have normal files that start with .
(and maybe even a hostname?).
I suggest you simply look for a path separator (\
on Windows and /
on Unix). No hostname can contain those. So you can do that check first and avoid the stat()
call completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the comment! I like the comment about /
and \
, but stat()
also serves the purpose to make sure the file exists and that the user has the access, like you proposed in previous attempt. Need to establish that knowledge before calling loadViewerParameters()
. I can return back to fopen()
and make some special handling for the permission denied case, if you like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What extra error handling do we actually need? Just call loadViewerParameters()
and handle any exception. It will tell you why the file couldn't be opened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I wanted to dodge any failures in fopen()
in the event that the given argument in fact was a host. However, with your latest comment about checking for the path separator, we can distinguish if we have a file or hostname directly (or at least supposed to be). I understand now and will change accordingly, thank you for the persistently good code review comments! Please bear with me :)
5818dad
to
53c04b2
Compare
@CendioOssman, please let me know if any other issues remain in the latest amendment. |
The C++ code looks good now. :) But the Java code should be changed to match so we don't have different behaviours. (And we don't need the amendments in the commit message. Your original comment works fine. :) ) |
The user can specify a tigervnc configuration file as an argument to the viewer. Previously the viewer assumed this to be a server, but now we will first check if there is any file matching the given argument. If so, try to load the content of that file, like we normally do. Fixes issue TigerVNC#38.
53c04b2
to
50439d7
Compare
Thanks again for your patience! I have aligned the two clients (added checking for empty server name in the C++ version too) and removed the amendment comments in the commit message. I am still learning best practices when working in GitHub, so I appreciate all the pointers you can give me :) @CendioOssman, notice anything else that should be done here? |
Was there some reason why this was not done as a switch? |
A switch often makes it more difficult to integrate with "Open with" features in other programs. |
Thank you for your hard work. Looks good now. |
The user can specify a tigervnc configuration file as an argument to the
viewer. Previously the viewer assumed this to be a server, but now we
will first check if there is any file matching the given argument. If
so, try to load the content of that file, like we normally do.
Fixes issue #38.