diff options
| author | Nathan Jaremko | 2019-02-24 16:52:01 -0500 | 
|---|---|---|
| committer | Nathan Jaremko | 2019-02-24 17:53:19 -0500 | 
| commit | 22e617eec8e2d8da36788ae40fb53c2ed2ebe734 (patch) | |
| tree | 99ecbf8a7df65c9748b73debf9ece08ad9858315 /src/migration_handler.rs | |
| parent | e54af75fa1fe7f5e9da3bd858058ab491efea77a (diff) | |
| download | podcast-22e617eec8e2d8da36788ae40fb53c2ed2ebe734.tar.bz2 | |
Improve code0.8.0
Diffstat (limited to 'src/migration_handler.rs')
| -rw-r--r-- | src/migration_handler.rs | 16 | 
1 files changed, 16 insertions, 0 deletions
| diff --git a/src/migration_handler.rs b/src/migration_handler.rs new file mode 100644 index 0000000..73a0241 --- /dev/null +++ b/src/migration_handler.rs @@ -0,0 +1,16 @@ +use crate::errors::*; +use crate::utils::*; +use std::fs; + +pub fn migrate_old_subscriptions() -> Result<()> { +    let path = get_podcast_dir()?; +    let mut old_path = path.clone(); +    old_path.push(".subscriptions"); +    if old_path.exists() { +        println!("Migrating old subscriptions file..."); +        let new_path = get_sub_file()?; +        fs::rename(&old_path, &new_path) +            .chain_err(|| format!("Unable to move {:?} to {:?}", &old_path, &new_path))?; +    } +    Ok(()) +} | 
