Roaming Gamer Particle Editor 2 Update

** UPDATED ANNOUCEMENT**

This is a quickie announcement to notify users that my free particle editor has been updated.

Recently a user found a bug where the tool was unable to create a folder it needed when generating emitters and emitter test projects.

This is a COMPLETE FIX for Windows and OS X users.

The Tool & Docs

The app now creates the ‘output’ folder ’ RGPE2_out’ on your desktop as soon as the app starts.

Generating emitters and projects now both work.

 
 

It appeared to work for me, I’d be curious if it works for others too, but here’s the Mac desktop path in 1 line :slight_smile:

local desktopPath= (string.sub((system.pathForFile(system.DocumentsDirectory)),1,(string.find( system.pathForFile(system.DocumentsDirectory),"/",8)))).."Desktop/"

Based on this forum post (https://forums.coronalabs.com/topic/58202-save-to-and-retrieve-from-directory/) it should be /Users/YOURHOMEFOLDER/ and I believe it’s always called Desktop.

Based on the assumption that it is always ‘/Users/’ and ‘Desktop’. It is on all 3 of my Macs.

I did create a directory in there successfully, as well as checked the files with

for file in lfs.dir( desktopPath ) do -- "file" is the current file or directory name print( "Found file: " .. file ) end

Slightly hokey, but functional!

(Access to “specialFolderPath(“desktop”)” would have been nice, but I couldn’t find a way to do it.

Anyway, thought I’d throw it out there.

Graham

I’ll look into this and see if my discovery method is coming up with the same path.  

I assumed it was working since it worked in the past, but as we all know things change.  I wonder if this isn’t something that changed since 10.10 and I missed it?

So, bad me if my assumption is the source of this issue.

Thanks for the code!

Well it turns out it was my fault.  An old change in SSK2’s OS detection system didn’t get propagated to the files library for OS X tests.

Thus, I was NOT running my OS path detection code and falling back on defaults which were wrong.  Bad Designer, No Twinkie.

This is now fixed for ALL users, Windows and OSX:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/SSK2/tools/rgpe2.zip

Thanks Graham for giving me the motivation to check this out and some fallback code if mine failed.  Speaking of which I’ll share my code below in a moment…

For those who are interested, this is the ‘summary’ of my path discovery of ‘dekstop’ and the equivalent of ‘my documents’ on OS X…

Username Discover with primary method and two fallbacks

-- OSX Discovery Utility local function getUserName() -- 1. Try the $USER variable local user = os.getenv("USER") if( user ) then print("Found $USER == " .. tostring( user ) ) return user end -- 2. Try extracting it from the $HOME path local user = os.getenv("HOME") if( user ) then print("Found $HOME == ", user ) user = string.split(user, "/") user = user[#user] if( user ) then print("Got USER from $HOME == " .. tostring( user ) ) return user end end -- 3. Try the $LOGNAME variable local user = os.getenv("LOGNAME") if( user ) then print("Got USER from $LOGNAME == " .. tostring( user ) ) return user end return nil end

My Documents

local pathSep = ( ssk.system.onWin ) and "\\" or "/" RGFiles.myDocumentsRoot = "" if( ssk.system.onOSX ) then RGFiles.myDocumentsRoot = getUserName() if( not RGFiles.myDocumentsRoot ) then RGFiles.myDocumentsRoot = "TBD" else RGFiles.myDocumentsRoot = "/Users/" .. RGFiles.myDocumentsRoot .. "/" .. "Documents" end end RGFiles.myDocumentsRoot = RGFiles.myDocumentsRoot .. pathSep

Desktop

RGFiles.desktopRoot = "" if( ssk.system.onOSX ) then RGFiles.desktopRoot = getUserName() if( not RGFiles.desktopRoot ) then RGFiles.desktopRoot = "TBD" else RGFiles.desktopRoot = "/Users/" .. RGFiles.desktopRoot .. "/" .. "Desktop" end end RGFiles.desktopRoot = RGFiles.desktopRoot .. pathSep

Everything works now, good job!

It works perfectly, thanks man

It appeared to work for me, I’d be curious if it works for others too, but here’s the Mac desktop path in 1 line :slight_smile:

local desktopPath= (string.sub((system.pathForFile(system.DocumentsDirectory)),1,(string.find( system.pathForFile(system.DocumentsDirectory),"/",8)))).."Desktop/"

Based on this forum post (https://forums.coronalabs.com/topic/58202-save-to-and-retrieve-from-directory/) it should be /Users/YOURHOMEFOLDER/ and I believe it’s always called Desktop.

Based on the assumption that it is always ‘/Users/’ and ‘Desktop’. It is on all 3 of my Macs.

I did create a directory in there successfully, as well as checked the files with

for file in lfs.dir( desktopPath ) do -- "file" is the current file or directory name print( "Found file: " .. file ) end

Slightly hokey, but functional!

(Access to “specialFolderPath(“desktop”)” would have been nice, but I couldn’t find a way to do it.

Anyway, thought I’d throw it out there.

Graham

I’ll look into this and see if my discovery method is coming up with the same path.  

I assumed it was working since it worked in the past, but as we all know things change.  I wonder if this isn’t something that changed since 10.10 and I missed it?

So, bad me if my assumption is the source of this issue.

Thanks for the code!

Well it turns out it was my fault.  An old change in SSK2’s OS detection system didn’t get propagated to the files library for OS X tests.

Thus, I was NOT running my OS path detection code and falling back on defaults which were wrong.  Bad Designer, No Twinkie.

This is now fixed for ALL users, Windows and OSX:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/SSK2/tools/rgpe2.zip

Thanks Graham for giving me the motivation to check this out and some fallback code if mine failed.  Speaking of which I’ll share my code below in a moment…

For those who are interested, this is the ‘summary’ of my path discovery of ‘dekstop’ and the equivalent of ‘my documents’ on OS X…

Username Discover with primary method and two fallbacks

-- OSX Discovery Utility local function getUserName() -- 1. Try the $USER variable local user = os.getenv("USER") if( user ) then print("Found $USER == " .. tostring( user ) ) return user end -- 2. Try extracting it from the $HOME path local user = os.getenv("HOME") if( user ) then print("Found $HOME == ", user ) user = string.split(user, "/") user = user[#user] if( user ) then print("Got USER from $HOME == " .. tostring( user ) ) return user end end -- 3. Try the $LOGNAME variable local user = os.getenv("LOGNAME") if( user ) then print("Got USER from $LOGNAME == " .. tostring( user ) ) return user end return nil end

My Documents

local pathSep = ( ssk.system.onWin ) and "\\" or "/" RGFiles.myDocumentsRoot = "" if( ssk.system.onOSX ) then RGFiles.myDocumentsRoot = getUserName() if( not RGFiles.myDocumentsRoot ) then RGFiles.myDocumentsRoot = "TBD" else RGFiles.myDocumentsRoot = "/Users/" .. RGFiles.myDocumentsRoot .. "/" .. "Documents" end end RGFiles.myDocumentsRoot = RGFiles.myDocumentsRoot .. pathSep

Desktop

RGFiles.desktopRoot = "" if( ssk.system.onOSX ) then RGFiles.desktopRoot = getUserName() if( not RGFiles.desktopRoot ) then RGFiles.desktopRoot = "TBD" else RGFiles.desktopRoot = "/Users/" .. RGFiles.desktopRoot .. "/" .. "Desktop" end end RGFiles.desktopRoot = RGFiles.desktopRoot .. pathSep

Everything works now, good job!

It works perfectly, thanks man