Closed pagdot closed 3 weeks ago
That's interesting, it should ignore them completely. But, it would be a nice addition to get it to treat them all as separate models.
They show up grouped as ".". So for some reason the ignoring doesn't work for me right now
Can you pop in a screenshot of the model page that has all your root files in it? Particularly the info section at the side.
Can also create a bug for this issue^^
Huh. How odd. Yeah, I think this might be a bug and a feature request, it shoudn't be doing that.
I'm no ruby guy, but looking at the source, I've found this line:
folders_with_changes.delete("/")
Seems like for some reason, the root folder of the library is called "." on my system and not "/"
Good spot, that's probably right!
what filesystem are you using? Could be something to do with that perhaps.
A few more findings:
$ echo 'File.dirname("abc")' | irb
Switch to inspect mode.
File.dirname("abc")
"."
$ echo 'File.dirname("/abc")' | irb
Switch to inspect mode.
File.dirname("/abc")
"/"
I don't understand everything from the parsing code and don't want to invest the time right now to dig deeper in ruby, but it seems like to have a file group with /
as foldername (which will be removed), it is required that the the path of the file starts with /
. I'm not sure in what case that would happen because File.glob('**')
paths would start without leading slash. Maybe something there I don't understand. Do you have models in the libraries root folder or can put one or two there to verify this behaviour?
what filesystem are you using? Could be something to do with that perhaps.
btrfs. Would expect the file system to not matter from what I know
Because this also a bug, here a few infos about my system:
services:
manyfold:
container_name: manyfold
restart: unless-stopped
image: lscr.io/linuxserver/manyfold:0.74.2
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- DATABASE_URL=postgresql://manyfold:REDACTED@manyfold-db:5432/manyfold
- REDIS_URL=redis://manyfold-redis
- SECRET_KEY_BASE=REDACTED
volumes:
- ./config:/config
- ./libraries/cloud:/libraries/cloud
networks:
- default
- reverse-proxy
redis:
container_name: manyfold-redis
image: redis:7
restart: always
networks:
- default
db:
image: postgres:16
container_name: manyfold-db
restart: always
environment:
POSTGRES_PASSWORD: REDACTED
POSTGRES_USER: manyfold
POSTGRES_DB: manyfold
user: 1000:1000
volumes:
- ./db:/var/lib/postgresql/data
networks:
- default
networks:
default:
reverse-proxy:
external: true
Ah, interesting, could be because whether or not it has a leading slash in the library path. What's the actual path you have set in the library? You should be able to see it down the bottom of the settings page.
/libraries/cloud
This shouldn't matter, because a base path is used:
Dir.glob(pattern, flags, base: Shellwords.escape(path)).filter { |x| File.file?(File.join(path, x)) }
https://github.com/manyfold3d/manyfold/blob/main/app/models/library.rb#L121C7-L121C104
This should make all paths "local" to the base path and I'm not sure how this would cause the root folder to be /
Tried to create a simple example (this is on an ext4 disk):
mkdir -p /tmp/rubytest/{a,b/c}
touch /tmp/rubytest/{f,a/fa,b/fb,b/c/fc}
echo 'path="/tmp/rubytest"; Dir.glob("**/*", base: path).filter { |x| File.file?(File.join(path, x)) }.map { |f| "#{File.dirname(f)}: #{File.basename(f)}" }' | irb
Switch to inspect mode.
path="/tmp/rubytest"; Dir.glob("**/*", base: path).filter { |x| File.file?(File.join(path, x)) }.map { |f| "#{File.dirname(f)}: #{File.basename(f)}" }
["a: fa", "b/c: fc", "b: fb", ".: f"]
I don't see how the root folder can be /
when using base: path
. Pretty sure it is always .
Hm, you're right, that might be a case that's slipped through the tests and changed when I rewrote the file handling.
Is your feature request related to a problem? Please describe.
I organized my 3d models on disk where I only create a folder, if I have multiple files belonging together. So the root folder of my library contains single models and folders with models belonging together. Right now manyfold creates one model for all loose files in the root folder of the library.
Describe the solution you'd like
Be able (maybe configurable) to not group the files in the root folder together
Describe alternatives you've considered
Manually (or using a script) move each loose file to a new folder