mirror of
https://github.com/timvisee/ffsend.git
synced 2025-10-06 02:29:57 +02:00
Reimplement boolean environment variables, properly this time
This commit is contained in:
parent
a644792259
commit
70bbf02762
4 changed files with 18 additions and 12 deletions
|
@ -6,9 +6,10 @@ extern crate fs2;
|
|||
extern crate open;
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::env::current_exe;
|
||||
use std::env::{current_exe, var_os};
|
||||
#[cfg(feature = "clipboard")]
|
||||
use std::error::Error as StdError;
|
||||
use std::ffi::OsStr;
|
||||
use std::fmt::{Debug, Display};
|
||||
use std::io::{
|
||||
Error as IoError,
|
||||
|
@ -633,3 +634,10 @@ pub fn app_history_file_path_string() -> String {
|
|||
.unwrap()
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
/// Check whether an environment variable with the given key is present in the context of the
|
||||
/// current process. The environment variable doesn't have to hold any specific value.
|
||||
/// Returns `true` if present, `false` if not.
|
||||
pub fn env_var_present(key: impl AsRef<OsStr>) -> bool {
|
||||
var_os(key).is_some()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue