-
Notifications
You must be signed in to change notification settings - Fork 33
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
[WIP] u3d/installation: add feature to create shortcuts #336
base: master
Are you sure you want to change the base?
Conversation
da171f8
to
ed3dce4
Compare
Some questions
More comments in the review itself. |
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec| | |||
spec.add_dependency 'inifile', '>= 3.0.0', '< 4.0.0' # Parses INI files | |||
spec.add_dependency 'plist', '>= 3.1.0', '< 4.0.0' # Generate the Xcode config plist file | |||
spec.add_dependency 'security', '= 0.1.3' # macOS Keychain manager, a dead project, no updates expected | |||
spec.add_dependency 'win32-shortcut', '>= 0.3.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.
see overall comment related to platform specific dependency.
|
||
if File.exist? lnk_path | ||
UI.message "Shortcut already exists at #{lnk_path}" | ||
return Win32::Shortcut.open(lnk_path) |
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.
why do we open it here?
c.syntax = 'u3d shortcuts [-u | --unity_version <version>] [-t | --target <folder>]' | ||
c.option '-u', '--unity_version STRING', String, 'Creates a shortcut for this version of Unity only.' | ||
c.option '-d', '--directory STRING', String, 'Specifies which directory to create the shortcuts in' | ||
c.example 'Create a shortcut for all installed versions on the Desktop', 'u3d shortcuts -d ~/Desktop' |
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.
is it risky to create shortcuts for all versions without specifying --all?
end | ||
|
||
shortcut = Win32::Shortcut.new(lnk_path) do |s| | ||
s.description = "Shortcut to Unity.exe for Unity #{unity_version}. Automatically created by u3d." |
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.
do we need to remove shortcuts when uninstalling?
command :shortcuts do |c| | ||
c.syntax = 'u3d shortcuts [-u | --unity_version <version>] [-t | --target <folder>]' | ||
c.option '-u', '--unity_version STRING', String, 'Creates a shortcut for this version of Unity only.' | ||
c.option '-d', '--directory STRING', String, 'Specifies which directory to create the shortcuts in' |
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.
This seems optional. It should document where it creates the screenshot when it isn't passed.
require 'win32-shortcut' | ||
full_exe_path = File.expand_path(path_to_unity_exe) | ||
lnk_parent = if target_directory.nil? | ||
File.expand_path('..', full_exe_path) |
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.
weird implementation of a default no?
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.
shouldn't it be the desktop? In which case, should it be passed to the function (and let the caller define it).
Pull Request Checklist
bundle exec rspec
to make sure that my PR didn't break any testbundle exec rubocop
to make sure that my PR is inline with our code stylePull Request Description
This brings a small QoL improvement which enables one to create shortcuts for his Unity installs in any directory.
Relies on the win32-shortcut gem.