Fix no such file or directory when using login (#164)

This commit is contained in:
ByteDream 2023-02-27 11:17:32 +01:00
parent 19f9d26af9
commit d6f1262c1c

View file

@ -18,6 +18,8 @@ pub struct Login {
impl Execute for Login { impl Execute for Login {
async fn execute(self, ctx: Context) -> Result<()> { async fn execute(self, ctx: Context) -> Result<()> {
if let Some(login_file_path) = login_file_path() { if let Some(login_file_path) = login_file_path() {
fs::create_dir_all(login_file_path.parent().unwrap())?;
match ctx.crunchy.session_token().await { match ctx.crunchy.session_token().await {
SessionToken::RefreshToken(refresh_token) => Ok(fs::write( SessionToken::RefreshToken(refresh_token) => Ok(fs::write(
login_file_path, login_file_path,