diff options
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(()) +} | 
