Network Installation

achandler

  • Posts: 12
Yes I need a general one, I want it to default their home drive so N: for example. or even using the %USERNAME% variable.

I was hoping there would be something I could change with ther prefs file but couldn't see one for workspace.

coleislazy

  • *
  • Posts: 2607
The StencylWorks.prefs file, in the user's directory (C:\Users\UserName\ in Win7) contains this line: global.workdir=. Make that equal the path, and you're golden. I think.

TomEllard

  • Posts: 27
I'm getting ready to try this on a Mac OSX network.
We build a "Standard Operating Environment" on one machine and then the default image gets duplicated to all other SOE machines. The student's home directory is on the network. As they log in, scripts set up links for all evil software to work transparently.

When Stencyl is installed it unpacks into a sub folder of Applications as far as I can tell - which would be imaged before first run. Then the student can use Preferences > Workspace Folder to move their assets to their network home or a portable drive. Is that right? Is Stencyl going to need to write to any other managed parts of the System?

My support guys are excellent at getting horrors to work over a network (Pro Tools!!!) but I want to make their job easier.  :)

Jon

  • *
  • Posts: 17524
That sounds correct to me.

As I mentioned to achandler and some others, we expect to default the workspace on Mac to the user's home folder in the future, which makes sense for Mac users like us.

achandler

  • Posts: 12
Our problem is that the prefs are stored within the user folder, all our students use mandatory profiles which are deleted nightly, so I am going to try to find a way round this.  Ideally making Stencyl look for the prefs file in a different location.  This is my biggest problem and if I can solve this then I should be good to go.


I did notice that that when I changed my workspace to N: it copied nearly 90MB of data into the home drive.  If I change the save location to N:\Stencyl though, then only 8MB gets copied over, I find this odd.


As regards to what TomEllard said, it is an ideal situation to start on a new computer image, and in future Stencyl would be included within our image, however we are now mid term and the next time there is a decent amount of time to do any amount of reimaging is Easter.

gerardsweeney

  • Posts: 8
I've been trying this as well - with limited success.

1. Install SW on a test PC1
2. Copy installed c:\program files\Stencylworks to Test PC2
3. On Test PC2 have a small BAT with:

echo global.workdir.style=true> %USERPROFILE%\StencylWorks.prefs
echo global.extension.style=true>> %USERPROFILE%\StencylWorks.prefs
echo global.workdir=H:/>> %USERPROFILE%\StencylWorks.prefs
"StencylWorks.exe"

saved in

c:\program files\Stencylworks

(H: being the directory that user's "My Documents" are redirected to)

When I run that as my administrator level user then it works. However if I run it as a non-admin user (such as a pupil or teacher) then I get a dialog box stating that the workspace is set to an unwritable directory.

I've checked that the H: drive isn't full (it isn't).

If I click OK at that warning prompt and then CANCEL at the next dialog about copying files over then the program loads using H: as the workspace?!

The log file shows Checking workspace writability: H:\/temp



On the subject of using H: for the workspace. When the workspace is redirected, it takes anywhere from 30-60 seconds to close down Stencylworks - even if all I've done is open the program. This happens whether running as Admin level user or not.

The H: drive is on a network share hosted in the same building connected via 1Gb so I'm going to assume it's not a bandwidth issue :)

Any advice welcome!

Alexin

  • *
  • Posts: 3127
- The installer requires admin privileges, there's no way around it.
- Executing SW doesn't require such privileges, as long as the workspace is set to a writable directory (ie. user's home folder).
- Updating requires admin privileges since it needs to write to a potentially restricted directory.
- The installer automatically creates a new workspace in the user's home folder if the prefs files isn't found. It also copies the games in the installation directory to the newly created workspace.

Basically, any action that requires access to a restricted directory needs admin privileges. This includes the default install directory, ..\Program Files\StencylWorks.
"Find the fun"
alexin@stencyl.com

achandler

  • Posts: 12
I'm tempted to create a simple script to run Stencyl instead.

So the shortcut int eh start menu instead of just running the Stencyl.exe, firstly creates (or moves a correct one) the prefs files within C:\Users\%USERNAME%\ which seems similar to what you are trying to achieve Gerard but being done in a slightly different method.

This isn't ideal but it would guarantee the Stencyl preferences are always correct, I will try it and let people know how it goes. As my major issue is that the prefs file is saved within an area that is deleted nightly.

Jon

  • *
  • Posts: 17524
By preferences file, do you mean StencylWorks.prefs, not the folder called stencylworks-prefs that actually contains most of the user-set preferences?


gerardsweeney

  • Posts: 8
Aha! Progress!

I found that if I set the workspace dir in the prefs file to H:\StencylWorks then it works - so long as I also created the necessary sub-directories as well. Otherwise it hangs when creating a new game because the "games" sub-dir isn't present.

Try it as just H:\ and you get the non-writable error. So I'm happy to roll with it in a subdirectory :)


I've changed my launcher to a compiled AutoIt script as I've had to change a good bit more in the generated prefs files such as auto-adding the proxy details. My pupils and teachers use different proxy servers, so my launcher reads those in.

Here's the code. Please don't wet yourselves laughing at it too much :)

Code: [Select]
; Generate prefs file and then run exe
#include <file.au3>

Dim $Name
Dim $WorkDir
Dim $exe

$Name = "StencylWorks"
$Exe = @ScriptDir & "\" & $Name & ".exe"

CheckExe()
FindWorkDir()
CopyPrefs()
GenPrefsFile()

; Finally run the app
Run($exe, @ScriptDir)


; ======================================================================
Func CheckExe()
; First check main exe is there :)
If FileExists($Exe) = 0 then
Exit
EndIf
EndFunc
; ======================================================================

; ======================================================================
Func FindWorkDir()
$MyDocs = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", "Personal")
If @Error <> 0 then
; Can't resolve My Documents dir so kill the script :)
Exit
EndIf

; Make sure My Documents path has a trailing backslash
If StringRight($MyDocs, 1) <> "\" then
$MyDocs = $MyDocs & "\"
EndIf

$WorkDir = $MyDocs & $Name
EndFunc
; ======================================================================

; ======================================================================
Func CopyPrefs()
; Create necessary subdirectories
$WorkSubDir = $WorkDir & "\" & $Name
DirCreate($WorkSubDir & "\extensions")
DirCreate($WorkSubDir & "\games")
DirCreate($WorkSubDir & "\logs")
DirCreate($WorkSubDir & "\preview")

$DestPrefsDir = $WorkSubDir & "\prefs"
DirCreate($DestPrefsDir)

; Copy prefs file over from main one but don't erase existing
$SourcePrefsDir =@ScriptDir & "\prefs"
$SourcePrefsFiles = _FileListToArray($SourcePrefsDir, "*.*", 1)
If @Error = 0 then
For $PrefsLoop = 1 to $SourcePrefsFiles[0]
$SFile = $SourcePrefsDir & "\" & $SourcePrefsFiles[$PrefsLoop]
$DFile = $DestPrefsDir & "\" & $SourcePrefsFiles[$PrefsLoop]
FileCopy($SFile, $DFile, 0)
Next
EndIf

; Get rid of log files from previous runs
; Added for users with quota'd home folders since the log files
; can potentially get quite chunky
FileDelete($WorkSubDir & "\logs\*.log")


UpdateBootFile($DestPrefsDir)
EndFunc
; ======================================================================

; ======================================================================
Func GenPrefsFile()
; Generate clean prefs file
$PrefsFile = @UserProfileDir & "\" & $Name & ".prefs"
$P = "global.workdir.style=true" & @CRLF
$P = $P & "global.extension.style=true" & @CRLF
$P = $P & "global.workdir=" & $WorkDir & @CRLF
$W = FileOpen($PrefsFile, 2)
FileWriteLine($W, $P)
FileClose($W)
EndFunc
; ======================================================================

; ======================================================================
Func UpdateBootFile($Dir)
; Update bootfile with proxy settings
; Complete fudge - copy it as an ini and then use AU3's iniwrite to update
$BootFile = $Dir & "\Boot.txt"
If FileExists($BootFile) = 0 then
Return
EndIf

$Proxy = ""
$Port = ""

; Look for proxy settings in per-user IE
$Key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
$PString = RegRead($Key, "ProxyServer")
$PortBreak = StringInStr($PString, ":", 0, -1)
If $PortBreak <> 0 then
$Proxy = StringMid($PString, 1, ($PortBreak -1))
$Port = StringMid($PString, ($PortBreak +1))
EndIf


$BootText = FileRead($BootFile)
$TempFile = @TempDir & "\Boot.txt.ini"

$Sec = "Temp"
$IniHeader = "[" & $Sec & "]"
$W = FileOpen($TempFile, 2)

FileWriteLine($W, $IniHeader & @CRLF)
FileWriteLine($W, $BootText)
FileClose($W)
IniWrite($TempFile, $Sec, "proxy.port", $Port)
IniWrite($TempFile, $Sec, "temp.path", @TempDir & "\" & $Name & "Temp")
IniWrite($TempFile, $Sec, "proxy.username", @UserName)
IniWrite($TempFile, $Sec, "proxy.host", $Proxy)

; Now strip the ini bit so it's normal text and copy it back as the live file
$BootText = FileRead($TempFile)
$BootText = StringReplace($BootText, $IniHeader, "")

$W = FileOpen($BootFile, 2)
FileWriteLine($W, $BootText)
FileClose($W)

EndFunc
; ======================================================================


So far, it seems to run correctly for my pupils and teachers.. I can browse and download from the online resources. I've no idea how to go about writing a game before I can publish it. I tried creating a game with an empty scene and publish that as a WIP but it rejected it..

Likewise, running the Update checker (as me) resulted in an error.

I'm hoping to speak to my IT guys to monitor what's going on at the proxy server to see if my transactions are going through or are being rejected for some reason.


Joe

  • *
  • Posts: 2478
Thanks for the updates. Glad to see some progress being made here.

gerardsweeney

  • Posts: 8
Another problem has raised its head.

In our IT suites, we have the per-user Start Menu and desktop locked to a read-only network share to prevent users from saving anything to their desktop.

Unfortunately, when I run Stencylworks on that, Java appears to be working out the user profile location based on the parent folder of where the desktop (or Start Menu?) is rather than using the inbuilt %USERPROFILE% variable.

So for example, we have the per-user desktop set to \\server\desktops$\Room7\User\Desktop. When I run Stencyl as myself (where I have write access to this share), the per-user Stencylworks.prefs file is created in \\server\desktops$\Room7\User

Because users can't normally write to this location it was causing the program to crash.

I've copied the Stencylworks.prefs file my script normally generates across to this (wrong) location, and teachers/pupils can run it.

Gerard

Joe

  • *
  • Posts: 2478
It's my understanding that we're grabbing the System property user.home to obtain the profile location. Interestingly, it looks like your issue could be due to a bug in the JVM: http://bugs.sun.com/view_bug.do?bug_id=4787931

One thing you could try doing would be to launch StencylWorks via a commandline script that sets the user.home property to be %USERPROFILE%. E.g.,

java -Xms64m -Xmx1024m -Djava.library.path=lib -jar sw.jar -Duser.home=%USERPROFILE%

« Last Edit: January 13, 2012, 06:47:19 am by Joe »

gerardsweeney

  • Posts: 8
Thanks for that..

I read through the bug report on there - I was amused at someone suggesting Sun were planning a 10th anniversary for this bug :)