Where is NSTemproryDirectory present? - iphone

I am doing image caching and I am saving the files to a temporary directory NSTemporaryDirectory. Its seen in log as /var/folders/.... .Where is this thing present. I am currently doing all this in the simulator?

You can use the following line to find out:
NSLog(NSTemporaryDirectory());
Gives me the path path like this: /var/folders/c9/c9ooh947H2WloiBIdpTdcU+++TI/-Tmp-/
You can browse there in terminal:
cd /var/folders/c9/c9ooh947H2WloiBIdpTdcU+++TI/-Tmp-/
/var folder is hidden on MacOS and is not shown in Finder by default. You can switch on showing hidden folders using this terminal command:
defaults write com.apple.finder AppleShowAllFiles -bool true
After that it must become visible in Finder in root folder

Related

Open user variable location from cmd

I created a user environment variable name: teamf and its value as C:\Program Files\TeamExplorer\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\
This is working since from run I can open the folder by merely typing %teamf%
Now I want to change the directory from root to to this folder location in command prompt (cmd). How can I do that? I have tried:
%teamf% cd teamf
but I get errors (see attached image please)
This should do it:
CD "%teamf%"

Total Commander external editor emacs "permission denied" on editing files

I configured my Total Commander so I can open a file *.txt i.e. within emacs.
Therefore I setup my Editor
D:\Tools\emacs\bin\emacsclientw.exe "%1"
When I now open my file everything is ok. But when I edit it and save it emacs tells me the following:
Saving file c:/log.txt...
basic-save-buffer-2: Opening output file: permission denied, c:/log.txt
How do I make it run so it can actually edit files?
By Default you should not be saving anything to root C:\
It is just bad practice and by default a normal user does not have permission to it.
Instead, create a working DIR in your Documents folder and a log directory in that, then you will have something like:
C:\Users\Frank\Documents\Working\logs\log.txt
This should not create any permission errrors.

Why is the "dir" command not showing me certain folders?

I used the dir command in the Windows command prompt to display the list of files/folders in a directory. I noticed that it did not display a folder named tmp. However, I tried running dir in Powershell, and it did display the tmp folder in the output. Why did the Windows command prompt hide this folder from me?
You need to add the "show hidden" option to dir:
dir /a
this should do the trick.
source
Try attrib /?. EG attrib c:\folder\tmp /d.
A leading dot means nothing in Windows.

Matlab, dos() command : files remain "in use"

After executing some simple commands like
dos('copy *.txt new.txt', '-echo')
dos('echo. 2 > EmptyFile.txt', '-echo')
I tried to delete the folder in which these files were created. However, Windows gives me the message
"cannot delete "FolderName": the folder is being used by another person/program".
I have to close Matlab to make it work.
How do I solve this? I guess it's something like closing the "session" of cmd commands...
What you're not showing is the change of working directory to your folder. Windows won't let you delete a folder that a process has as a current working directory.
The solution is simple: change the working directory out of that folder. Say:
cd('..')

Updating bash environment variables using source

On OS X Mountain Lion The source command only seems to update my path when I have added something to it in .bashrc or .bash_profile. If I delete a path from either of these files, then use source to update, the deleted path remains. An example...
Adding to my PATH in .bash_profile
In terminal
> echo $PATH
> "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin"
Add to path in .bash_profile
export PATH=$PATH:~/Desktop
Back in terminal
> source .bash_profile
> echo $PATH
> "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/myname/Desktop"
So, all that went as expected; my Desktop has been added to my PATH. Now after I delete the previously added path from .bash_profile, leaving this file empty
> source .bash_profile
> echo $PATH
> "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/myname/Desktop"
As you can see the 'deleted' path '/Users/myname/Desktop' remains. Am I misunderstanding what
source does? I thought It was equivalent to opening a new terminal window (which does return
the result I was expecting - i.e. no Desktop path)
When you use source .bash_profile first time, because of export PATH=$PATH:~/Desktop line from .bash_profile file, your PATH is reassigned to old PATH to which is added ~/Desktop directory.
When you use source .bash_profile second time, the PATH is not anymore reassigned because you delete export PATH=$PATH:~/Desktop line. So, this time the value of your PATH remains unchanged (like before).
You have to restart your terminal (current shell) if you want that the value of your PATH to return to its initial value. Or you can source your /etc/environment file:
source /etc/environment