SavePathUtils.smali

.class public Lio/rong/imlib/common/SavePathUtils;
.super Ljava/lang/Object;
.source "SavePathUtils.java"


# static fields
.field private static final TAG:Ljava/lang/String; = "SavePathUtils"

.field private static savePath:Ljava/lang/String; = ""


# direct methods
.method static constructor <clinit>()V
    .registers 0

    return-void
.end method

.method public constructor <init>()V
    .registers 1

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static getSavePath(Ljava/io/File;)Ljava/io/File;
    .registers 2

    .line 3
    invoke-static {}, Lio/rong/imlib/common/SavePathUtils;->isSavePathEmpty()Z

    move-result v0

    if-eqz v0, :cond_7

    goto :goto_e

    :cond_7
    new-instance p0, Ljava/io/File;

    sget-object v0, Lio/rong/imlib/common/SavePathUtils;->savePath:Ljava/lang/String;

    invoke-direct {p0, v0}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    :goto_e
    return-object p0
.end method

.method public static getSavePath()Ljava/lang/String;
    .registers 1

    .line 1
    sget-object v0, Lio/rong/imlib/common/SavePathUtils;->savePath:Ljava/lang/String;

    return-object v0
.end method

.method public static getSavePath(Ljava/lang/String;)Ljava/lang/String;
    .registers 2

    .line 2
    invoke-static {}, Lio/rong/imlib/common/SavePathUtils;->isSavePathEmpty()Z

    move-result v0

    if-eqz v0, :cond_7

    goto :goto_9

    :cond_7
    sget-object p0, Lio/rong/imlib/common/SavePathUtils;->savePath:Ljava/lang/String;

    :goto_9
    return-object p0
.end method

.method public static isDir(Ljava/lang/String;)Z
    .registers 3

    .line 1
    new-instance v0, Ljava/io/File;

    invoke-direct {v0, p0}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 2
    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result p0

    const/4 v1, 0x0

    if-nez p0, :cond_14

    .line 3
    sget-object p0, Lio/rong/imlib/common/SavePathUtils;->TAG:Ljava/lang/String;

    const-string v0, "SavePath not exists.."

    invoke-static {p0, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    return v1

    .line 4
    :cond_14
    invoke-virtual {v0}, Ljava/io/File;->isDirectory()Z

    move-result p0

    if-nez p0, :cond_22

    .line 5
    sget-object p0, Lio/rong/imlib/common/SavePathUtils;->TAG:Ljava/lang/String;

    const-string v0, "SavePath not Directory.."

    invoke-static {p0, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    return v1

    :cond_22
    const/4 p0, 0x1

    return p0
.end method

.method public static isSavePathEmpty()Z
    .registers 1

    .line 1
    sget-object v0, Lio/rong/imlib/common/SavePathUtils;->savePath:Ljava/lang/String;

    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    return v0
.end method

.method public static setSavePath(Ljava/lang/String;)V
    .registers 2

    .line 1
    invoke-static {p0}, Lio/rong/imlib/common/SavePathUtils;->isDir(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_8

    .line 2
    sput-object p0, Lio/rong/imlib/common/SavePathUtils;->savePath:Ljava/lang/String;

    :cond_8
    return-void
.end method