I’m currently stuck with the patcher for my game. This game isn’t big and will be mostly updated for friends. I was wondering if I could get some help. I am getting the following error:

System.ArgumentException: Name has invalid chars
at System.IO.FileStream…ctor

I have the diff file on google that it reads and parses through. Then it will download the file from my raw files(also on google drive) and save it to the users local directory. For testing purposes I have made this directory C:\games. I am downloading and saving binary files so they don’t have a file extension like .exe or .txt.
Here is my Code:

This checks if there is an update needed:

function checkForUpdates(){	//for the patcher. Check the version first. 
	buildVersion = "1.0.0";
	updating = true;
	showUpdateButton = false;
	updateMsg = "

Checking For Updates…"; //GUI update for user
yield WaitForSeconds(1.0f); //make it visible
var url = “https://googledrive.com/host/0B9EJGlco2Hy6fkU4QVVzMlQ0QnBqTmVjazZTR2dTSkJJal83eEhlYVJsU1puSjA2b3h3VU0/version.txt”; //txt file with version # in it
updateMsg = "

Establishing Connection…";//GUI update for user
var patchwww:WWW = WWW(url); //create new web connection to the build number site
yield patchwww; // wait for download to finish

    if (patchwww.text == buildVersion){    //check version
       	updateMsg = "

Currently update to date.";
yield WaitForSeconds(1.0f);
updating = false;
showGUI = true;
}
else {
patch = patchwww.text;
updateMsg = "Update Available.

Current Version: “+buildVersion+”
Patch Version: “+patchwww.text+”

Would you like to download updates?";
showUpdateButton = true;
}
}

The following two functions go about apply and downloading the update(The actual applying is not implemented yet):

function applyUpdate(fileListing:String){
	updateMsg = "

Identifying Platform";
var currPatch = “https://googledrive.com/host/0B9EJGlco2Hy6fkU4QVVzMlQ0QnBqTmVjazZTR2dTSkJJal83eEhlYVJsU1puSjA2b3h3VU0/patch_v"+fileListing+".txt”;
if(Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXEditor){
updateMsg = "

Identifying updates for the Mac platform

Establishing Connection…";
//savePath += “/…/…/”; //use this to find the executable
}
else if(Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor){
updateMsg = "

Identifying updates for the Windows platform

Establishing Connection…";
rawDataFolder =“https://googledrive.com/host/0B9EJGlco2Hy6fmUxQzN3ZVAtYkczRzA0S29ubjhfVGVBUFpHTm9HRmxOeldraDhhOXBCa1E/”;
rawExc = “https://googledrive.com/host/0B9EJGlco2Hy6fkFNeVZELXZqRTc5M01sT1lOWjNfUC1nRmlpcEJfaTczQW1QMHBoMnV0TjA/The Dark Tower.exe”;
//savePath += “/…/”; //use this to find the executable
}

	updateMsg = "

Retrieving List of Files To Be Patched…“;
var patchlist:WWW = WWW(currPatch);
yield patchlist;
var fileList = patchlist.text;
var fileListArray:String = fileList.Split(”
" [0]);
var fileSaveSuccess = true;
for (var i = 0; i < fileListArray.Length; i++)
{
updateMsg = "

File “+i+” of “+fileListArray.Length+”

Downloading "+fileListArray*;*
_ yield downloadFile(fileListArray*);_
_
if(errorOccured == true){_
_
break;_
_
}_
_
}_
_
if(errorOccured == false){_
_
updateMsg = "

File List Retrieved and Downloaded.“;_
_
}_
_
}_
This is the function im having problems with:
function downloadFile(file:String){
_
var download:WWW = WWW(rawDataFolder+”"+file); //download file from platforms raw folder*_
yield download; // wait for download to finish
// var saveLoc = Application.persistentDataPath; //Location where the files will go
var saveLoc = “C:/games”;
try{
* Debug.Log(saveLoc+“/”+file);*
* File.WriteAllBytes (saveLoc+“/”+file, download.bytes); //<----PROBLEM HERE.*
}
catch(error){
* var errorMsg = “”;*
* var charCount = 0;*
* errorMsg = “”;*
* for(var i = 0; i < error.ToString().Length; i++){*
* charCount += 1;*
* if(charCount%15 == 0){*
* errorMsg += error.ToString().Substring(i, i+15);*
* errorMsg += "
";*

* }*
* if(charCount >89){*
* errorMsg +=“…”;*
* break;*
* }*
* }*

* updateMsg ="Make sure to run this game as Administrator - Error:
"+errorMsg;*

* errorOccured = true;*
* Debug.Log(error);*
}
}
Any help or direction on this one would be helpful.
EDIT: I just found this link
_*http://docs.unity3d.com/Manual/binarydata.html*_
where it talks about saving binary data. However, I don’t really understand a whole lot of what is happening in that example script.

Make sure your path and file name doesn’t have any special characters like space or & or | etc… Some OS doesn’t supports it.
I guess that’s why you having the error.