Adobe Air URLRequest to Local File Works Windows 7, Not 10










0














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;










share|improve this question























  • 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










  • 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















0














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;










share|improve this question























  • 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










  • 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













0












0








0







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;










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 15:20

























asked Nov 12 '18 at 20:53









user3221479

155




155











  • 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










  • 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










  • 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












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
);



);













draft saved

draft discarded


















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















draft saved

draft discarded
















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














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





















































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







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3