Adobe Air URLRequest to Local File Works Windows 7, Not 10
I developed an Adobe Air App for a small intranet. All computers have been running Windows 7, but now are beginning to be replaced with Windows 10 systems. I can access the mapped drive "I" and the local "C" drive using the file class on Windows 7 machines, but only the mapped drive "I" on Windows 10.
Edit: Capabilities.localFileReadDisable returns false on both Windows 7 and Windows 10 systems.
****I could bypass the need for the local file if Air could get any specific information about the machine it is running on, serial number, mac address, computer name, etc. It really makes no difference what information I get, it just has to be unique to that computer. And using cookies isn't an option because they are volatile****
The following code accomplishes two things.
First, it displays the running version of the Air file and looks for a file on a mapped drive with the latest version available. If they are the same, the computer is running the latest version. If they aren't the same, the new version is displayed to the user, indicating the app should be updated.
Second, it grabs the name of the specific computer from a text file residing on the local drive. That name is used on reports to indicate which computer was being used. There is probably a far superior way to accomplish this, but on Windows 7, it works perfectly for me. Unfortunately, Windows 10 throws an error when trying to access the file on the local drive.
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file:///C:/machineName.txt
Any help would be greatly appreciated.
var appXML:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXML.namespace();
version_txt.text = "V"+appXML.ns::versionNumber;
// Define path to the version number
var updatePath:URLRequest = new URLRequest("file:///I:/air/update.txt");
// Define path to name of specific pc
var machineName:URLRequest = new URLRequest("file:///C:/machineName.txt");
// Define the URLLoaders
var updateLoader:URLLoader = new URLLoader();
function checkUpdate():void
updateLoader.load(updatePath);
var nameLoader:URLLoader = new URLLoader();
function checkName():void
nameLoader.load(machineName);
// Listen for when the file has finished loading.
updateLoader.addEventListener(Event.COMPLETE, loaderComplete);
function loaderComplete(e:Event):void
// The output of the text file is available via the data property
// of URLLoader.
if(Number(appXML.ns::versionNumber)<Number(updateLoader.data))
update_txt.text = "UPDATE TO V"+updateLoader.data;
nameLoader.addEventListener(Event.COMPLETE, nameComplete);
var name_txt:String = new String;
function nameComplete(e:Event):void
name_txt = nameLoader.data;
var holder:String = version_txt.text;
version_txt.text = name_txt+" ** "+holder;
actionscript-3 air flash-cs6
add a comment |
I developed an Adobe Air App for a small intranet. All computers have been running Windows 7, but now are beginning to be replaced with Windows 10 systems. I can access the mapped drive "I" and the local "C" drive using the file class on Windows 7 machines, but only the mapped drive "I" on Windows 10.
Edit: Capabilities.localFileReadDisable returns false on both Windows 7 and Windows 10 systems.
****I could bypass the need for the local file if Air could get any specific information about the machine it is running on, serial number, mac address, computer name, etc. It really makes no difference what information I get, it just has to be unique to that computer. And using cookies isn't an option because they are volatile****
The following code accomplishes two things.
First, it displays the running version of the Air file and looks for a file on a mapped drive with the latest version available. If they are the same, the computer is running the latest version. If they aren't the same, the new version is displayed to the user, indicating the app should be updated.
Second, it grabs the name of the specific computer from a text file residing on the local drive. That name is used on reports to indicate which computer was being used. There is probably a far superior way to accomplish this, but on Windows 7, it works perfectly for me. Unfortunately, Windows 10 throws an error when trying to access the file on the local drive.
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file:///C:/machineName.txt
Any help would be greatly appreciated.
var appXML:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXML.namespace();
version_txt.text = "V"+appXML.ns::versionNumber;
// Define path to the version number
var updatePath:URLRequest = new URLRequest("file:///I:/air/update.txt");
// Define path to name of specific pc
var machineName:URLRequest = new URLRequest("file:///C:/machineName.txt");
// Define the URLLoaders
var updateLoader:URLLoader = new URLLoader();
function checkUpdate():void
updateLoader.load(updatePath);
var nameLoader:URLLoader = new URLLoader();
function checkName():void
nameLoader.load(machineName);
// Listen for when the file has finished loading.
updateLoader.addEventListener(Event.COMPLETE, loaderComplete);
function loaderComplete(e:Event):void
// The output of the text file is available via the data property
// of URLLoader.
if(Number(appXML.ns::versionNumber)<Number(updateLoader.data))
update_txt.text = "UPDATE TO V"+updateLoader.data;
nameLoader.addEventListener(Event.COMPLETE, nameComplete);
var name_txt:String = new String;
function nameComplete(e:Event):void
name_txt = nameLoader.data;
var holder:String = version_txt.text;
version_txt.text = name_txt+" ** "+holder;
actionscript-3 air flash-cs6
Do you get a similar error if you try to read your text file withFileStream
instead ofURLLoader
?
– Brian
Nov 15 '18 at 22:50
No error. But if simply import flash.filesystem.File and create the file object with var myFile:File = File.applicationDirectory, I can trace(myFile.nativePath) and get the correct path returned. I placed a text file in that directory and pointed myFile to it with myFile = myFile.resolvePath("tempfile.txt"). When I trace(myFile.exists), it returns false. I tried putting it in the different locations available to the file system, but it returns false each time.
– user3221479
Nov 16 '18 at 17:39
Okay, resolved. The file extension ".txt" was displayed on the file in Windows. Turns out that Windows 7 didn't seem to have a problem with Air resolving the file name WITH the file extension. Windows 10 doesn't like it. The moment I removed the ".txt" both URLRequest and FileStream began working as expected in Windows 10.
– user3221479
Nov 16 '18 at 18:05
add a comment |
I developed an Adobe Air App for a small intranet. All computers have been running Windows 7, but now are beginning to be replaced with Windows 10 systems. I can access the mapped drive "I" and the local "C" drive using the file class on Windows 7 machines, but only the mapped drive "I" on Windows 10.
Edit: Capabilities.localFileReadDisable returns false on both Windows 7 and Windows 10 systems.
****I could bypass the need for the local file if Air could get any specific information about the machine it is running on, serial number, mac address, computer name, etc. It really makes no difference what information I get, it just has to be unique to that computer. And using cookies isn't an option because they are volatile****
The following code accomplishes two things.
First, it displays the running version of the Air file and looks for a file on a mapped drive with the latest version available. If they are the same, the computer is running the latest version. If they aren't the same, the new version is displayed to the user, indicating the app should be updated.
Second, it grabs the name of the specific computer from a text file residing on the local drive. That name is used on reports to indicate which computer was being used. There is probably a far superior way to accomplish this, but on Windows 7, it works perfectly for me. Unfortunately, Windows 10 throws an error when trying to access the file on the local drive.
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file:///C:/machineName.txt
Any help would be greatly appreciated.
var appXML:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXML.namespace();
version_txt.text = "V"+appXML.ns::versionNumber;
// Define path to the version number
var updatePath:URLRequest = new URLRequest("file:///I:/air/update.txt");
// Define path to name of specific pc
var machineName:URLRequest = new URLRequest("file:///C:/machineName.txt");
// Define the URLLoaders
var updateLoader:URLLoader = new URLLoader();
function checkUpdate():void
updateLoader.load(updatePath);
var nameLoader:URLLoader = new URLLoader();
function checkName():void
nameLoader.load(machineName);
// Listen for when the file has finished loading.
updateLoader.addEventListener(Event.COMPLETE, loaderComplete);
function loaderComplete(e:Event):void
// The output of the text file is available via the data property
// of URLLoader.
if(Number(appXML.ns::versionNumber)<Number(updateLoader.data))
update_txt.text = "UPDATE TO V"+updateLoader.data;
nameLoader.addEventListener(Event.COMPLETE, nameComplete);
var name_txt:String = new String;
function nameComplete(e:Event):void
name_txt = nameLoader.data;
var holder:String = version_txt.text;
version_txt.text = name_txt+" ** "+holder;
actionscript-3 air flash-cs6
I developed an Adobe Air App for a small intranet. All computers have been running Windows 7, but now are beginning to be replaced with Windows 10 systems. I can access the mapped drive "I" and the local "C" drive using the file class on Windows 7 machines, but only the mapped drive "I" on Windows 10.
Edit: Capabilities.localFileReadDisable returns false on both Windows 7 and Windows 10 systems.
****I could bypass the need for the local file if Air could get any specific information about the machine it is running on, serial number, mac address, computer name, etc. It really makes no difference what information I get, it just has to be unique to that computer. And using cookies isn't an option because they are volatile****
The following code accomplishes two things.
First, it displays the running version of the Air file and looks for a file on a mapped drive with the latest version available. If they are the same, the computer is running the latest version. If they aren't the same, the new version is displayed to the user, indicating the app should be updated.
Second, it grabs the name of the specific computer from a text file residing on the local drive. That name is used on reports to indicate which computer was being used. There is probably a far superior way to accomplish this, but on Windows 7, it works perfectly for me. Unfortunately, Windows 10 throws an error when trying to access the file on the local drive.
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file:///C:/machineName.txt
Any help would be greatly appreciated.
var appXML:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXML.namespace();
version_txt.text = "V"+appXML.ns::versionNumber;
// Define path to the version number
var updatePath:URLRequest = new URLRequest("file:///I:/air/update.txt");
// Define path to name of specific pc
var machineName:URLRequest = new URLRequest("file:///C:/machineName.txt");
// Define the URLLoaders
var updateLoader:URLLoader = new URLLoader();
function checkUpdate():void
updateLoader.load(updatePath);
var nameLoader:URLLoader = new URLLoader();
function checkName():void
nameLoader.load(machineName);
// Listen for when the file has finished loading.
updateLoader.addEventListener(Event.COMPLETE, loaderComplete);
function loaderComplete(e:Event):void
// The output of the text file is available via the data property
// of URLLoader.
if(Number(appXML.ns::versionNumber)<Number(updateLoader.data))
update_txt.text = "UPDATE TO V"+updateLoader.data;
nameLoader.addEventListener(Event.COMPLETE, nameComplete);
var name_txt:String = new String;
function nameComplete(e:Event):void
name_txt = nameLoader.data;
var holder:String = version_txt.text;
version_txt.text = name_txt+" ** "+holder;
actionscript-3 air flash-cs6
actionscript-3 air flash-cs6
edited Nov 15 '18 at 15:20
user3221479
asked Nov 12 '18 at 20:53
user3221479user3221479
155
155
Do you get a similar error if you try to read your text file withFileStream
instead ofURLLoader
?
– Brian
Nov 15 '18 at 22:50
No error. But if simply import flash.filesystem.File and create the file object with var myFile:File = File.applicationDirectory, I can trace(myFile.nativePath) and get the correct path returned. I placed a text file in that directory and pointed myFile to it with myFile = myFile.resolvePath("tempfile.txt"). When I trace(myFile.exists), it returns false. I tried putting it in the different locations available to the file system, but it returns false each time.
– user3221479
Nov 16 '18 at 17:39
Okay, resolved. The file extension ".txt" was displayed on the file in Windows. Turns out that Windows 7 didn't seem to have a problem with Air resolving the file name WITH the file extension. Windows 10 doesn't like it. The moment I removed the ".txt" both URLRequest and FileStream began working as expected in Windows 10.
– user3221479
Nov 16 '18 at 18:05
add a comment |
Do you get a similar error if you try to read your text file withFileStream
instead ofURLLoader
?
– Brian
Nov 15 '18 at 22:50
No error. But if simply import flash.filesystem.File and create the file object with var myFile:File = File.applicationDirectory, I can trace(myFile.nativePath) and get the correct path returned. I placed a text file in that directory and pointed myFile to it with myFile = myFile.resolvePath("tempfile.txt"). When I trace(myFile.exists), it returns false. I tried putting it in the different locations available to the file system, but it returns false each time.
– user3221479
Nov 16 '18 at 17:39
Okay, resolved. The file extension ".txt" was displayed on the file in Windows. Turns out that Windows 7 didn't seem to have a problem with Air resolving the file name WITH the file extension. Windows 10 doesn't like it. The moment I removed the ".txt" both URLRequest and FileStream began working as expected in Windows 10.
– user3221479
Nov 16 '18 at 18:05
Do you get a similar error if you try to read your text file with
FileStream
instead of URLLoader
?– Brian
Nov 15 '18 at 22:50
Do you get a similar error if you try to read your text file with
FileStream
instead of URLLoader
?– Brian
Nov 15 '18 at 22:50
No error. But if simply import flash.filesystem.File and create the file object with var myFile:File = File.applicationDirectory, I can trace(myFile.nativePath) and get the correct path returned. I placed a text file in that directory and pointed myFile to it with myFile = myFile.resolvePath("tempfile.txt"). When I trace(myFile.exists), it returns false. I tried putting it in the different locations available to the file system, but it returns false each time.
– user3221479
Nov 16 '18 at 17:39
No error. But if simply import flash.filesystem.File and create the file object with var myFile:File = File.applicationDirectory, I can trace(myFile.nativePath) and get the correct path returned. I placed a text file in that directory and pointed myFile to it with myFile = myFile.resolvePath("tempfile.txt"). When I trace(myFile.exists), it returns false. I tried putting it in the different locations available to the file system, but it returns false each time.
– user3221479
Nov 16 '18 at 17:39
Okay, resolved. The file extension ".txt" was displayed on the file in Windows. Turns out that Windows 7 didn't seem to have a problem with Air resolving the file name WITH the file extension. Windows 10 doesn't like it. The moment I removed the ".txt" both URLRequest and FileStream began working as expected in Windows 10.
– user3221479
Nov 16 '18 at 18:05
Okay, resolved. The file extension ".txt" was displayed on the file in Windows. Turns out that Windows 7 didn't seem to have a problem with Air resolving the file name WITH the file extension. Windows 10 doesn't like it. The moment I removed the ".txt" both URLRequest and FileStream began working as expected in Windows 10.
– user3221479
Nov 16 '18 at 18:05
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269928%2fadobe-air-urlrequest-to-local-file-works-windows-7-not-10%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269928%2fadobe-air-urlrequest-to-local-file-works-windows-7-not-10%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you get a similar error if you try to read your text file with
FileStream
instead ofURLLoader
?– Brian
Nov 15 '18 at 22:50
No error. But if simply import flash.filesystem.File and create the file object with var myFile:File = File.applicationDirectory, I can trace(myFile.nativePath) and get the correct path returned. I placed a text file in that directory and pointed myFile to it with myFile = myFile.resolvePath("tempfile.txt"). When I trace(myFile.exists), it returns false. I tried putting it in the different locations available to the file system, but it returns false each time.
– user3221479
Nov 16 '18 at 17:39
Okay, resolved. The file extension ".txt" was displayed on the file in Windows. Turns out that Windows 7 didn't seem to have a problem with Air resolving the file name WITH the file extension. Windows 10 doesn't like it. The moment I removed the ".txt" both URLRequest and FileStream began working as expected in Windows 10.
– user3221479
Nov 16 '18 at 18:05