Bug 14780 - readdir() and other Lua methods are not cross-platform, particularly with windows
: readdir() and other Lua methods are not cross-platform, particularly with win...
Status: RESOLVED FIXED
Product: SB Desktop
Classification: Unclassified
Component: Desktop
: 7.4.x
: PC Windows XP
: P4 normal (vote)
: 7.5.x
Assigned To: Unassigned bug - please assign me!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-14 20:47 UTC by Jim McAtee
Modified: 2011-01-14 11:29 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments
new readdir for windows (772 bytes, patch)
2009-10-15 16:36 UTC, KDF
Details | Diff
detect windows and modify where needed. (2.42 KB, patch)
2009-10-15 17:16 UTC, KDF
Details | Diff
easier fix. (803 bytes, patch)
2009-10-16 09:31 UTC, KDF
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jim McAtee 2009-10-14 20:47:30 UTC
All of the wallpapers are installed, but Settings > Screen > Wallpaper offers a blank menu to choose from.  You can change the wallpaper only by manually editing \userpath\settings\SetupWallpaper.lua.
Comment 1 James Richardson 2009-10-15 11:42:00 UTC
Ben: this one yours to fix?
Comment 2 Ben Klaas 2009-10-15 11:46:05 UTC
this is a windows build problem. probably a dup with a few others re: windows squeezeplay, but i'll leave it open for now.
Comment 3 KDF 2009-10-15 16:36:39 UTC
Created attachment 6126 [details]
new readdir for windows

Coincidentally I was looking at this today.  It's a problem with / when using readdir.  Unfortunately, not sure how to make this cross-platform.  The trailing slash can't be there for windows either, as it fails when using lfs.attributes so you have to add it later.  All I can find for OS detection in jive lua so far is getMachine and getArch and I'm not sure if we can isolate windows software with just that given that you can run lots of oses on i386 to run squeezeplay software.
Comment 4 KDF 2009-10-15 17:16:48 UTC
Created attachment 6127 [details]
detect windows and modify where needed.

This detects windows based on something I found elsewhere.  Can't require os or string in Applet.lua so it has to be detected elsewhere and passed.  This may not be the right place to do it, but this does seem to do what's required to make wallpapers work.  Other places where readdir is used won't benefit from this until detection is instead done at higher level, and in something that CAN be loaded in Applet.lua
Comment 5 Ben Klaas 2009-10-16 08:20:08 UTC
We need to make sure we have a cross-platform solution for any filepaths and not hardcode / in the construction of paths. That's the root issue of this bug, so changing the summary to reflect that.
Comment 6 KDF 2009-10-16 09:31:35 UTC
Created attachment 6135 [details]
easier fix.

Looks like the slash problem is not quite what it seemed.  While it looked nutty to have the slashes mixed, it's really just the trailing slash that has to be delayed so that attributes can return a valid value.  Haven't tested on osx or linux as I cannot get local builds to complete without compiler errors.
Comment 7 SVN Bot 2009-10-16 09:48:58 UTC
 == Auto-comment from SVN commit #7880 to the jive repo by bklaas ==
 == https://svn.slimdevices.com/jive?view=revision&revision=7880 ==

Bug: 14780
Description: patch from KDF (thanks!) to deal with windows-specific issue with readdir()
reviewed and tested against OS X with no issue
Comment 8 Chris Owens 2010-03-08 11:24:46 UTC
Moving lower-priority bugs to next target
Comment 9 Chris Owens 2010-05-06 15:37:56 UTC
Tom is no longer available to us
Comment 10 Mickey Gee 2011-01-14 11:29:14 UTC
Isn't this one fixed? I'm assuming so unless told otherwise.