-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add .editorconfig and .gitattributes, normalize line endings
- Loading branch information
Showing
6 changed files
with
695 additions
and
681 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
// Copyright 2017, Igor Shaula | ||
// Licensed under the MIT License <LICENSE or | ||
// http://opensource.org/licenses/MIT>. This file | ||
// may not be copied, modified, or distributed | ||
// except according to those terms. | ||
#[macro_use] | ||
extern crate serde_derive; | ||
extern crate winreg; | ||
use winreg::enums::*; | ||
use std::collections::HashMap; | ||
use std::fmt; | ||
|
||
#[allow(non_snake_case)] | ||
#[derive(Debug, Serialize, Deserialize)] | ||
struct InstalledApp { | ||
DisplayName: Option<String>, | ||
DisplayVersion: Option<String>, | ||
UninstallString: Option<String> | ||
} | ||
|
||
macro_rules! str_from_opt { | ||
($s:expr) => { $s.as_ref().map(|x| &**x).unwrap_or("") } | ||
} | ||
|
||
impl fmt::Display for InstalledApp { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "{}-{}", | ||
str_from_opt!(self.DisplayName), | ||
str_from_opt!(self.DisplayVersion)) | ||
} | ||
} | ||
|
||
fn main() { | ||
let hklm = winreg::RegKey::predef(HKEY_LOCAL_MACHINE); | ||
let uninstall_key = hklm.open_subkey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall") | ||
.expect("key is missing"); | ||
|
||
let apps: HashMap<String, InstalledApp> = uninstall_key.decode().expect("deserialization failed"); | ||
|
||
for (_k, v) in &apps { | ||
println!("{}", v); | ||
} | ||
} | ||
// Copyright 2017, Igor Shaula | ||
// Licensed under the MIT License <LICENSE or | ||
// http://opensource.org/licenses/MIT>. This file | ||
// may not be copied, modified, or distributed | ||
// except according to those terms. | ||
#[macro_use] | ||
extern crate serde_derive; | ||
extern crate winreg; | ||
use winreg::enums::*; | ||
use std::collections::HashMap; | ||
use std::fmt; | ||
|
||
#[allow(non_snake_case)] | ||
#[derive(Debug, Serialize, Deserialize)] | ||
struct InstalledApp { | ||
DisplayName: Option<String>, | ||
DisplayVersion: Option<String>, | ||
UninstallString: Option<String> | ||
} | ||
|
||
macro_rules! str_from_opt { | ||
($s:expr) => { $s.as_ref().map(|x| &**x).unwrap_or("") } | ||
} | ||
|
||
impl fmt::Display for InstalledApp { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "{}-{}", | ||
str_from_opt!(self.DisplayName), | ||
str_from_opt!(self.DisplayVersion)) | ||
} | ||
} | ||
|
||
fn main() { | ||
let hklm = winreg::RegKey::predef(HKEY_LOCAL_MACHINE); | ||
let uninstall_key = hklm.open_subkey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall") | ||
.expect("key is missing"); | ||
|
||
let apps: HashMap<String, InstalledApp> = uninstall_key.decode().expect("deserialization failed"); | ||
|
||
for (_k, v) in &apps { | ||
println!("{}", v); | ||
} | ||
} |
Oops, something went wrong.