Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

love-release not packing everything in project directory #36

Closed
videah opened this issue Apr 9, 2016 · 5 comments
Closed

love-release not packing everything in project directory #36

videah opened this issue Apr 9, 2016 · 5 comments

Comments

@videah
Copy link

videah commented Apr 9, 2016

For some reason, only my font folder, conf.lua, and my readme gets packed.
Any reason this is happening?

@MisterDA
Copy link
Owner

I have stumbled upon this once too, but I wasn't able to identify the causes of this error. I'll try to fix this.

@pablomayobre
Copy link
Contributor

Would you please check the return value of fs.pop_dir

I think it may stay in that directory for ever

Also changing the current directory like that inside the loop may destroy the iterator

Consider saving all the folder names and after the whole folder was iterated, iterate on the next one

These are just suggestions not tested and not proved to work, but some ideas that may help debug this. Cheers

@MisterDA
Copy link
Owner

fs.pop_dir returns true if a pop ocurred, false if the stack was empty.

Thanks for the suggestions :)

Debug all the things !

@pablomayobre
Copy link
Contributor

Try something like this:

local _buildFileTree
_buildFileTree = function(dir)
  local subDirs = {}

  for file in assert(fs.dir()) do
    if not file:find("^%.git") then
      if fs.is_dir(file) then
        subDirs[#subDirs + 1] = file
      elseif fs.is_file(file) then
        dir[#dir+1] = file
      end
    end
  end

  for _, path in ipairs(subDirs) do
    local newDir = {}
    dir[path] = newDir
    assert(fs.change_dir(path))
    _buildFileTree(newDir)
    assert(fs.pop_dir())
  end
end

This has the overhead of needing a secondary loop but will probably work more reliably.

You have to consider that fs.dir returns an iterator based on a coroutine and Lua is not that good with coroutines, and handling multiple coroutines at once, switching between them and so on...

pablomayobre added a commit to pablomayobre/love-release that referenced this issue May 19, 2017
This issue was related to Lua not handling coroutines iterators right, the function being recursive generated multiple coroutine iterators and they didn't resume right. The solution is to make the first loop non-recursive and create a secondary loop where the recursive function is called.
MisterDA pushed a commit that referenced this issue May 19, 2017
This issue was related to Lua not handling coroutines iterators right, the function being recursive generated multiple coroutine iterators and they didn't resume right. The solution is to make the first loop non-recursive and create a secondary loop where the recursive function is called.
@pablomayobre
Copy link
Contributor

This should be fixed now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants