Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Cannot access created file

$
0
0

I am creating a file in this fashion

Settings = Titanium.Filesystem.getFile(Titanium.Filesystem.tempDirectory,'ProductData');
            Ti.API.info("Created Settings: " + Settings.createDirectory());
            Ti.API.info('Settings ' + Settings);
             newFile= Titanium.Filesystem.getFile(Settings.nativePath,'Settings.txt');
 
            newFile.createFile();
 
            if (newFile.exists()){
 
                newFile.write('line 1\n');
                 Ti.API.info('newfile: '+newFile.read());
            }
and i have declared var Settings and var newFile in my alloy.js file.

I get an error when i tried accessing the same file in another controller like this

if (newFile.exists()){      
 
     Ti.API.info('newfile here    : '+newFile.read());
            }
I am using 3.2.3 GA. What exactly is going wrong here ?since i have decalred these in my alloy.js and it is suppoed to be global

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>