Module: SkippyLib::Resource
- Defined in:
- modules/resource.rb
Overview
Constant Summary collapse
- VECTOR_FILETYPE =
The supported file format for vector icons depend on the platform.
(Platform.mac? ? 'pdf' : 'svg').freeze
Class Method Summary collapse
-
.icon_path(path) ⇒ String
Provide the path to a bitmap icon, which will be used for older SketchUp versions that doesn't support vector formats.
- .vector_path(path) ⇒ String
Class Method Details
.icon_path(path) ⇒ String
Provide the path to a bitmap icon, which will be used for older SketchUp versions that doesn't support vector formats.
For versions that do support vector formats it will return the path with the file extension that is compatible with the running OS.
If the vector variant doesn't exist the original path will be returned.
24 25 26 27 28 29 |
# File 'modules/resource.rb', line 24 def self.icon_path(path) return path unless Sketchup.version.to_i > 15 vector_icon = self.vector_path(path) File.exist?(vector_icon) ? vector_icon : path end |
.vector_path(path) ⇒ String
34 35 36 37 38 |
# File 'modules/resource.rb', line 34 def self.vector_path(path) dir = File.dirname(path) basename = File.basename(path, '.*') File.join(dir, "#{basename}.#{VECTOR_FILETYPE}") end |