Android Question File.MakeDir doesn´t seems to work properly

Discussion in 'Android Questions' started by cds-soft, Feb 3, 2015.

  1. cds-soft

    cds-soft Member Licensed User

    Sorry for this stupid question, but i don't know why this code always shows the folder doesn't exists.

    Code:
    Dim s As String
    s = 
    "todo"
    If File.Exists(File.DirInternal & s & "/""") = False Then
        
    ' Creamos la carpeta de descarga
        File.MakeDir(File.DirInternal, s)
        
    ' Validamos
        If File.Exists(File.DirInternal & s & "/""") = False Then
            
    Msgbox("Error""")
            
    Return
        
    End If
    End If
    Edit because I solved it :)

    Well this is the info for File.MakeDir (Info)
    Well, this is not correct.

    The correct command is...
    Code:
    File.MakeDir(File.DirInternal, "/music")
    And if you want to check if this directory exist, you can do
    Code:
    If File.Exists(File.DirInternal "/music""") = True Then
    OR
    Code:
    If File.Exists(File.DirInternal "/music/""") = True Then
    Both are accepted.

    I hope this will be usefull for B4A "newies" like me. And hope this info should be fixed.

    Thanks for your help and sorry for my english:(
     
    Last edited: Feb 3, 2015
    Devan likes this.
  2. NJDude

    NJDude Expert Licensed User

    lemonisdead and thedesolatesoul like this.
  3. cds-soft

    cds-soft Member Licensed User

    I think "IsDirectory" is to check if it's a directory or not.

    If you want to check a directory exist you have to do File.Exist with file name empty
    This return true.
    Code:
    File.Exists("/mnt/sdcard/Download/""")
    Thanks NJDude.
     
  4. NJDude

    NJDude Expert Licensed User

    Do not hard code the paths, not all devices are the same.
     
  5. cds-soft

    cds-soft Member Licensed User

    Yes, that's true. It's not a good example. Sorry.:confused:
    In my code i'm using File.DirInternal. Thanks.
     
  6. cds-soft

    cds-soft Member Licensed User

    Solved. Edit first post.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice