Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Random Album Button (I know its there, but...)
#4
The old code did not check for an existing mount of the same name before trying to create a new one. This caused a lot of issues.

moOde 4 series added validation for certain fields entered into the NAS config screen and also some simple code to check if the mount already exists. That code is below. It grep's the output of the mount command for the value entire into the Name field.

Code:
function mountExists($mountname) {
    $result = sysCmd('mount | grep -ow ' . '"' . $mountname .'"');
    if (!empty($result)) {
        return true;
    }
    else {
        return false;
    }
}

But since mount points are in the form /mnt/NAS/<Name> the function would always return true if "NAS" were not excluded from <Name>

I'm sure it could be improved on...
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Messages In This Thread
RE: Random Album Button (I know its there, but...) - by Tim Curtis - 12-10-2018, 09:05 PM

Forum Jump: