diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-06-18 11:33:29 -0300 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2018-06-21 16:02:50 +0100 |
| commit | d242d584bb9d0fed09e4f5b6138cf9e84197ec6a (patch) | |
| tree | 85b08057139ea059b018d99ad1a23471a61cb0ce | |
| parent | d73f96fcbb69ffdcd3a6c2a52cef0dc6afe8b75c (diff) | |
| download | mullvadvpn-d242d584bb9d0fed09e4f5b6138cf9e84197ec6a.tar.xz mullvadvpn-d242d584bb9d0fed09e4f5b6138cf9e84197ec6a.zip | |
Use custom backup path in `SystemStateWriter`
| -rw-r--r-- | talpid-core/src/firewall/system_state.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/talpid-core/src/firewall/system_state.rs b/talpid-core/src/firewall/system_state.rs index 18782d91cf..bf99b9f79f 100644 --- a/talpid-core/src/firewall/system_state.rs +++ b/talpid-core/src/firewall/system_state.rs @@ -6,8 +6,6 @@ use std::io; use std::path::{Path, PathBuf}; use std::slice; -const STATE_BACKUP_FILENAME: &str = "system_state_backup"; - /// This struct is responsible for saving a binary blob to disk. The binary blob is intended to /// store system state that should be resotred when the security policy is reset. pub struct SystemStateWriter { @@ -18,12 +16,10 @@ pub struct SystemStateWriter { impl SystemStateWriter { /// Creates a new SystemStateWriter which will use a file in the cache directory to store system /// state that has to be restored. - pub fn new<P: AsRef<Path>>(cache_dir: P) -> Self { - let backup_path = cache_dir - .as_ref() - .join(STATE_BACKUP_FILENAME) - .into_boxed_path(); - Self { backup_path } + pub fn new<P: AsRef<Path>>(backup_path: P) -> Self { + Self { + backup_path: backup_path.as_ref().to_owned().into_boxed_path(), + } } /// Writes a binary blob representing the system state to the backup location before any @@ -66,6 +62,7 @@ impl SystemStateWriter { #[cfg(test)] mod tests { extern crate tempfile; + use super::*; #[test] |
