Created
March 21, 2011 20:38
-
-
Save anonymous/880179 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module CrazyFunDotNet | |
| class DotNetLibrary < Tasks | |
| private | |
| def reference_assemblies_dir() | |
| program_files_dir ||= ENV['ProgramFiles(x86)'] ||= ENV['programfiles(x86)'] ||= ENV['PROGRAMFILES(X86)'] ||= "C:/Program Files (x86)" | |
| unless File.exists? program_files_dir | |
| program_files_dir ||= ENV['ProgramFiles'] ||= ENV['programfiles'] ||= ENV['PROGRAMFILES'] ||= "C:/Program Files" | |
| end | |
| return File.join(program_files_dir, 'Reference Assemblies', 'Microsoft', 'Framework') | |
| end | |
| def framework_dir() | |
| windows_dir ||= ENV['WinDir'] ||= ENV['windir'] ||= ENV['WINDIR'] ||= "C:/Windows" | |
| return File.join(windows_dir, 'Microsoft.NET', 'Framework') | |
| end | |
| def resolve_framework_reference(ref, version) | |
| if version == "3.5" | |
| assembly = File.join(reference_assemblies_dir(), "v" + version, ref) | |
| unless File.exists? assembly | |
| assembly = File.join(framework_dir(), "v2.0.50727", ref) | |
| end | |
| return assembly.to_s | |
| end | |
| return File.join(reference_assemblies_dir(), '.NETFramework', "v" + version, ref).to_s | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment