Skip to content

Commit

Permalink
Merge pull request #30 from araishikeiwai/absolute-path
Browse files Browse the repository at this point in the history
enabled absolute path in backup_dir
  • Loading branch information
tvdstaaij authored Jul 11, 2016
2 parents 46055f7 + 07ce645 commit 5a37d9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
}

# Target directory for the backup files
# It his is a relative path it will be relative to the script's directory
# If this is a relative path it will be relative to the script's directory
# Absolute path starts with '/' or '~'
backup_dir: './output'

# Maximum number of messages to backup for each target (0 means unlimited)
Expand Down
10 changes: 9 additions & 1 deletion lib/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ def get_full_name(user)
end

def get_backup_dir
File.expand_path(File.join('..', '..', $config['backup_dir']), __FILE__)
parent_dir =
case $config['backup_dir'][0]
when '/', '~'
$config['backup_dir']
else
['..', '..', $config['backup_dir']]
end

File.expand_path(File.join(parent_dir), __FILE__)
end

def get_media_dir(dialog)
Expand Down

0 comments on commit 5a37d9a

Please sign in to comment.