Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    2

    Lightbulb Tentative Fix: SqueezePlay crash when AppData is a UNC

    Hello,

    First, please understand that I am not a LUA programmer, so use this code with caution. It is my hope that one of the mainstream developers for this package will review the code below and incorporate it into a future build.

    Some of us who are on corporate networks get some or all of our folders redirected to a network location and that causes SqueezePlay to fail to start. A UNC (Universal/Uniform Naming Convention) is like \\server\share\path\... Where server is the name of the server, and share is the name of the published shared to access--you can't do a mkdir on these parts of the name, they must pre-exist.

    I opened "C:\Program Files (x86)\Squeezebox\SqueezePlay\lua\jive\AppletManage r.lua" (drop the " x86" if your Windows is 32-bit). If you are attempting this on your own, you may need to make a copy of the file somewhere else so you can save it. When done with the changes, copy it back to this location. MAKE A BACKUP FIRST!!!

    I then updated _mkdirRecursive as below. In my version, it starts on line 98. If you have an older or newer version, then it may be somewhere else.

    REMEMBER, I am NOT a LUA programmer, nor have I touched SqueezePlay source before--use with caution!

    Sorry about the lack of formatting, I am not sure how to force the post to keep the indentation.

    function _mkdirRecursive(dir)
    --normalize to "/"
    local dir = dir:gsub("\\", "/")
    local dirPrefix = dir:sub(1,2)
    local isUnc = false
    if dirPrefix == "//" then
    isUnc = true
    end

    local newPath = ""
    for i, element in pairs(string.split('/', dir)) do
    newPath = newPath .. element
    if isUnc and i > 4 or not isUnc and i ~= 1 then --first element is (for full path): blank for unix , "<drive-letter>:" for windows
    if lfs.attributes(newPath, "mode") == nil then
    log:debug("Making directory: " , newPath)

    local created, err = lfs.mkdir(newPath)
    if not created then
    error (string.format ("error creating dir '%s' (%s)", newPath, err))
    end
    end
    end
    newPath = newPath .. "/"
    end
    end

  2. #2
    Junior Member
    Join Date
    Sep 2009
    Posts
    4
    Thank you!

  3. #3
    Senior Member erland's Avatar
    Join Date
    Dec 2005
    Location
    Sweden
    Posts
    10,863
    Quote Originally Posted by PhxJim View Post
    Sorry about the lack of formatting, I am not sure how to force the post to keep the indentation.
    You can get the forum to produce a formatted version by surrounding it with:
    [ code ]
    ...
    [ /code ]
    (Remove the spaces before/after [])

    I haven't looked at the code in detail but this sounds like a bug, so maybe you should register it together with your patch at: http://bugs.slimdevices.com

    Formatted version comes here:
    Code:
    function _mkdirRecursive(dir)
        --normalize to "/"
        local dir = dir:gsub("\\", "/")
        local dirPrefix = dir:sub(1,2)
        local isUnc = false
        if dirPrefix == "//" then
        	isUnc = true
        end
       
        local newPath = ""
        for i, element in pairs(string.split('/', dir)) do
            newPath = newPath .. element
    	      if isUnc and i > 4 or not isUnc and i ~= 1 then --first element is (for full path): blank for unix , "<drive-letter>:" for windows
                if lfs.attributes(newPath, "mode") == nil then
                    log:debug("Making directory: " , newPath)
    
                    local created, err = lfs.mkdir(newPath)
                    if not created then
                        error (string.format ("error creating dir '%s' (%s)", newPath, err))
                    end	
                end
            end
            newPath = newPath .. "/"
        end
    end
    Erland Isaksson (My homepage)
    (Developer of many plugins/applets (both free and commercial).
    If you like to encourage future presence on this forum and/or third party plugin/applet development, consider purchasing some plugins)

    Interested in the future of music streaming ? ickStream - A world of music at your fingertips.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •