Catalina complaining of Network Access

  1. 7 months ago

    Andy B

    2 Dec 2019 Airdrie, AB, Canada

    When I run one of my apps on Catalina, it asks permission for the program to access network drives. I don't need access to network drives, so in a perfect world, this message would not come up.
    I understand that this message may go away once I've properly signed and notarized my app (still working on that), but for curiosity sake, is there a way to avoid looking at Network drives when trying to find a particular volume?
    My program performs a firmware update on an external device which shows up as an external USB drive, but it first has to find that device by checking each volume to see if the appropriate file is contained therein. I suppose it's scan is also looking at network drives, and this may be why Catalina is complaining.

    Is the following code causing the warning in Catalina? Can anyone suggest a "better" way to scan that would only look at external USB volumes?
    Oh - it's cross-platform so this has to work on Windows too. (It does currently)

    For CurVolNum as Integer = 0 to VolumeCount -1
      Try
        f = Volume(CurVolNum)
        If f.Count = 1 And f.item(1).Name = "firmware.bin" Then
          Exit For
        Else
          f = Nil
        End If
      Catch ex As IOException
        f = Nil
      End Try
    Next CurVolNum
  2. Beatrix W

    2 Dec 2019 Testers, Third Party Store Europe (Germany)

    The warnings won't go away when you sign and notarize your app.

    If you have a network volume mounted then you need to have access to it if you want to get the name. So this looks like a feature and not a bug.

  3. Andy B

    2 Dec 2019 Airdrie, AB, Canada

    Ok, so no way to identify network volumes and avoid them without getting their name? (Chicken/Egg?)

  4. Norman P

    2 Dec 2019 Testers, Xojo Pro outside admiring the sunshine,...

    I believe MBS has a plugin that can tell you if a volume is a network or local usb based one
    And that they even have such a thing for mac & windows

  5. Andy B

    2 Dec 2019 Airdrie, AB, Canada

    Ok. Probably not worth it just for this, but good to know.
    Thanks, Norman.

  6. Norman P

    2 Dec 2019 Testers, Xojo Pro outside admiring the sunshine,...

    pretty sure you could, on macOS, determine whether its a network drive or not by examining the output of the mount command and parsing it apart looking for the Volumes full path in that output

    mount tells you if the drive is local or not along with several other useful bits

  7. Tim J

    2 Dec 2019 Testers, Xojo Pro N. Phoenix, AZ

    Norman's method works for both macOS and Linux:

    theShell.Execute "mount"

    You will need to parse the "theShell.ReadAll" results, but it won't flag network access.

  8. Andy B

    2 Dec 2019 Airdrie, AB, Canada
    Edited 7 months ago

    What's "theShell" ?

    Would I need a completely different procedure on Windows?

  9. Norman P

    2 Dec 2019 Testers, Xojo Pro outside admiring the sunshine,...

    theShell is a Shell object instance

    dim theShell as new Shell
    theShell.Execute "mount"
    .. code here to parse the results apart
  10. Tim J

    2 Dec 2019 Testers, Xojo Pro N. Phoenix, AZ

    Sorry - my knowledge <> your knowledge :S

    Norman beat me to it. More clearly:

    Dim theShell As New Shell
    Dim mntResults(-1) As String
    Dim a As Integer
    
    theShell.Mode = 1
    theShell.Timeout = -1
    theShell.Execute "/bin/mount"
    Do
        theShell.Poll
    Loop Until Not theShell.IsRunning
    mntResults = SplitB(theShell.ReadAll)
    
    // Walk through the mntResults array to find your non-network volumes.
    For a = 0 To mntResults.Ubound
        ...
    Next
  11. Andy B

    2 Dec 2019 Airdrie, AB, Canada

    Gotcha. Thanks, Gents.

    On further thought, I'll just live with the customer needing to hit "Ok". Much less work.

or Sign Up to reply!