How to open another folder in VSCode in the same instance? - windows

Let's say I have 2 folders - apple & orange
Now I opened apple in VSCode using code apple.
In the embedded terminal in VSCode, how do I open orange folder in the same instance as apple by overriding it without starting a new instance?

Support for multi-root workspaces is there.vscode-insiders which support multiple projects at same time.Please refer to our documentation for a full explanation of all the features that come with it. Extension authors should refer to our wiki that explains the new extension APIs to make your extension ready for multi-root workspaces.
You can do it like this:
I just tried in my system it working perfectly fine to open a another folder in same instance
code -r path
Like: code -r C:\Users\admin\xxxx\xxxx\apple(orange already opened in the same instance)
If you want to open a existing folder in new window from terminal:
code -n Path
Like: code -n C:\Users\admin\xxxx\xxxx\apple(apple will opens in another window and orange also there.)
If you want to open a new tab in same instance by terminal:
code filename.extension (Hit enter then just press ctrl+S and then it saved the file in the same directory).
Thanks for the question.Hope this will match your curiosity B|

#rioV8 suggested this solution: File > Add Folder to Workspace ==> Multi Root Workspace

Related

How to open path directory in Mac

I'm a newbie to OSX.
I have installed android studio and created an test project.
I would like to open up the test project directory as what I can do in Windows.
Here is the path to the test project directory:
/Users/wenhao/AndroidStudioProjects
But I have no idea where to navigate the /Users directory.
Appreciate if someone can help me out.
--- EDIT ---
I recalled that I have accidentally deleted something from the finder.
So, in order for those section to show: please follow this post - http://www.mac-forums.com/forums/os-x-operating-system/193314-accidentally-removed-device-finder-sidebar.html
In Finder, you should have on the left side "Devices" section, and under that, "Macintosh HD". From there, you should be able to find the path you are looking for.
Alternately, you could open Terminal app (in the Utilities folder of your Applications); that should put you in the /Users/wenhao directory, where you can just issue the command open AndroidStudioProjects to show it in Finder.

appcfg.py is not running with cmd prompt (Windows 7)

I am having strange problem. I used to run appcfg.py to update my app to appengine but now its not working anymore. When I run this command
C:\Program Files <x86>\Google\google_appengine>appcfg.py update E:\path\myApp\
Its not giving me anything, no error no feedback. Its just back to this line
C:\Program Files <x86>\Google\google_appengine>
Any idea about this issue!
P.S. I'm using Python 2.7. My code is updating through google app launcher but I need to run it from cmd prompt as I will be downloading/uploading appengine stuff which launcher doesn't allow me to do!
Thanks
I still had a little trouble with the instructions. Here's the steps I used to create a batch file to use the Google App Engine download_app with Windows 7.
In my example,
I'll use drive, C:
Default python path will be, C:\Python27\python.exe
GAE path (include "), "C:\Program Files (x86)\Google\google_appengine\appcfg.py"
App ID {your_app_id} will be just your app-id name
{your_app_version} is the "Version:" number in your GAE app.yaml file
I'll create a folder on my Windows 7 desktop and call it GAE_App
The desktop folder path will be C:\Users\{username}\Desktop\GAE_App
{your email} will be the Gmail account connected to your GAE
Right-click on the desktop and select New->Text Document. Open the newly created text document and add the following line of code modified for your setup to the blank text document,
C:\Python27\python.exe "C:\Program Files (x86)\Google\google_appengine\appcfg.py" download_app -A {your_app_id} -V {your_app_version} --email={your email} C:\Users\{username}\Desktop\GAE_App
Save the text document and change the file name to GAE_Download.bat
It's important that the extension now says ".bat" instead of ".txt"
Once finished, click on the batch to execute it. You'll be asked for a password and then the files should download into the GAE_App folder on your desktop. Now, whenever you need to download your files, just click on the batch file.
Not sure why Google didn't simply include this feature with their GAE for Windows software.
I faced the same issue. Here is a simple solution.
Just do this following Steps:
Go to program file where google app engine is installed. Generally It is named as Google.
click on appcfg.py and select open with.. Select "Choose Default Programs".
Select Python from programs and select "Always Use the selected program to open this kind of file" .
Now run the command you should get the results on command line.
For reference click here
Fixed by accessing python lib like that
C:\Python27>python appcfg.py update E:\path\myApp\
Here's a solution that worked for me:
"google_appengine/appcfg.py" update "C:\PATH TO APP
The appcfg.bat that should be used is located **C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\appengine-java-sdk\bin** and not the empty appcfg.bat that for some unknown reason also was here C:\Program Files\Google\Cloud SDK\
Good practice is to add this path to the system variable PATH
This worked for me
Basis
<PATH_TO_PYTHON>python <PATH_TO_APPCFG.PY>appcfg.py -A <PROJECT_INSTANCE_NAME> update app.yaml
Example
X:\Software\Python2.7\python Q:\SOFTWARE\GoogleAppEngineSDK\appcfg.py -A great-1337 update app.yaml

myProject is locked for editing and you may not be able to save your changes?

I get the following error messages when I moved my code from my laptop to my Mac Mini and opened it over there:
myProject is locked for editing and you may not be able to save your changes?
myProject is currently locked because you are not the owner of the file and do not have write permission.
The file "xxx.xcuserdatad" could not be unlocked.
Could not add write permission to the file because you do not own it. Try modifying the permission of the file in the Finder or Terminal.
I did a search with Finder: What came up was a file called UserInterfaceState.xcuserstate inside of xxx.xcuserdatad... GetInfo showed the file not to be locked.
However looking at the path(from GetInfo) showed the file to be within "xxx.xcodeproj" and further within "project.xcworkspace/xcuserdata/xxx.xcuserdatad"
I can't find this anywhere, and I don't know how to use my project on another computer.
Go to the Folder in Finder where the xcode project is and right click -> Get info. The permissions and the bottom should be set to read/write and in my case they were. The trick is to click the settings icon at the bottom and select "Apply to enclosed items". The chmod method shown above doesn't change the permissions of the contents within the folder.
go to the folder in finder
right click on folder and click the "Get info"
go down to the bottom and click the lock and write administrator password
now click on the settings icon and press "Apply to enclosed items..."
Please note that I had to add the recursive command flag and sudo to get it to work for me:
$ sudo chown -R Roger my_app_folder/*
And:
$ sudo chmod -R 774 my_app_folder/*
Because I was getting this error:
chmod: Unable to change file mode on my_app_folder: Operation not
permitted
Have you tried copying the contents like suggested in this answer?:
Unable to unlock file for editing in Xcode 4?
Alternatively you could use the console to set yourself a writing permission on all the files for your xcode project:
http://www.mac-terminal.com/files-and-folders/permissions/chmod/

Possible to change where Android Virtual Devices are saved?

I've set up the Android SDK and Eclipse on my machine running Windows XP and AVDs (Android Virtual Devices) are saved to "Documents and Settings\user\.android" by default. Is there any way to change this behavior? I have all of the other components saved in a directory on a separate partition and would like everything to be consolidated. Obviously not a huge deal but does anyone here know a workaround for this?
Add a new user environment variable (Windows 7):
Start Menu > Control Panel > System > Advanced System Settings (on the left) > Environment Variables
Add a new user variable (at the top) that points your home user directory:
Variable name: ANDROID_SDK_HOME Variable value:
a path to a directory of your choice
AVD Manager will use this directory to save its .android directory into it.
For those who may be interested, I blogged about my first foray into Android development...
Android "Hello World": a Tale of Woe
Alternatively, you can use the Rapid Environment Editor to set the environment variables.
Based on official documentation https://developer.android.com/studio/command-line/variables.html you should change ANDROID_AVD_HOME environment var:
Emulator Environment Variables
By default, the emulator stores configuration files under
$HOME/.android/ and AVD data under $HOME/.android/avd/. You can
override the defaults by setting the following environment variables.
The emulator -avd command searches the avd directory in the
order of the values in $ANDROID_AVD_HOME,
$ANDROID_SDK_HOME/.android/avd/, and $HOME/.android/avd/. For emulator
environment variable help, type emulator -help-environment at the
command line. For information about emulator command-line options, see
Control the Emulator from the Command Line.
ANDROID_EMULATOR_HOME: Sets the path to the user-specific emulator configuration directory. The default location is
$ANDROID_SDK_HOME/.android/.
ANDROID_AVD_HOME: Sets the path to the directory that contains all AVD-specific files, which mostly consist of very large
disk images. The default location is $ANDROID_EMULATOR_HOME/avd/.
You might want to specify a new location if the default location is
low on disk space.
After change or set ANDROID_AVD_HOME you will have to move all content inside ~user/.android/avd/ to your new location and change path into ini file of each emulator, just replace it with your new path
Modify the file "virtual_android2.2.ini" in "C:\Documents and Settings{your windows login}.android\avd\":
target=android-8
path=E:\android_workspace\avd\virtual_android2.2.avd
And move the folder "virtual_android2.2.avd" from "C:\Documents and Settings{your windows login}.android\avd\" into "E:\android_workspace\avd\".
Move your .android to wherever you want it to.
Then, create a symlink like this:
# In your home folder
$ ln -s /path/to/.android/ .
This simply tells Linux that whenever the path ~/.android is referenced by any application, link it to /path/to/.android.
Go to the Android tools directory. Edit the android.bat command file. At about the end of the command file, find a line similar to
call %java_exe% -Djava.ext.dirs=%java_ext_dirs% -Dcom.android.sdkmanager.toolsdir="%tools_dir%" -Dcom.android.sdkmanager.workdir="%work_dir%" -jar %jar_path% %*
and replace
call %java_exe%
with
call %java_exe% -Duser.home={your_prefer_dir}
where {your_prefer_dire} is your preferred directory without braces but add doublequotes,
e.g.
call %java_exe% -Duser.home="E:\Program Files (x86)\android-sdk-windows"
For Visual Studio 2017 on Windows 10
Copy C:\Users\YOURUSERNAME\.android folder to (for example) E:\avd
Open the environment variables window:
Go into Settings and click on System.
On the left, click About and select System info at the
bottom.
In the new window, click Advanced system
settings on the left.
Click Environment Variables at
the bottom of the resulting window.
Add a new variable:
Variable name: ANDROID_SDK_HOME
Variable value: a path to a directory (e.g E:\avd)
Don't include .android in the variable value.
Restart Visual Studio.
For change SDK & NDK location go to:
Tools -> Options -> Xamarin -> Android Setting
You can change the .ini file for the new AVD:
target=android-7
path=C:\Users\username\.android\avd\VIRTUAL_DEVICE_NAME.avd
I don't know how to specify where the .ini file should be stored :)
In Windows 10 I had that problem because My C Drive was getting full and I had needed free Space, AVD folder had 14 gig space so I needed to move that folder to another driver, first answer not work for Me so I tested another way to fix it this problem,
I make a picture for you if you have the same problem, you don't need to move all of the files in .android folder to another drive (this way not work) just move avd folders in ....android\avd to another drive and open .ini files and change avd folder path from that file to the new path.
Like this image:
I hope this works for you.
Note: careful about a separate character before and after the path in ini file that you cannot see,if you remove that character it's not works
Check this out.
using the android command to create avd you can specify where to place files.
-p --path Location path of the directory where the new AVD will be created
The environmental variable ANDROID_AVD_HOME can be used to define the directory in which the AVD Manager shall look for AVD INI files and can therefore be used to change the location of the virtual devices;
The default value is %USERPROFILE%\.android\avd on Windows (or ~/.android/avd on Linux).
One can also create a link for the whole directory %USERPROFILE%\.android on Windows (or a sym-link for directory ~/.android on Linux).
When moving AVDs, the path entry in AVD INI file needs to be updated accordingly.
Another way to specify ANDROID_SDK_HOME without messing around with environment variables (especially when using ec2) is simply create a shortcut of eclipse and add the following as target
C:\Windows\System32\cmd.exe /C "setx ANDROID_SDK_HOME YOUR AVD PATH /M & YOUR ECLIPSE.EXE PATH"
This will set ANDROID_SDK_HOME as system variable whenever you launch eclipse.
HTH
Paul
Please take note of the following : modifying android.bat in the Android tools directory, as suggested in a previous answer, may lead to problems.
If you do so, in order to legitimately have your .android directory located to a non-default location then there may be an inconsistency between the AVDs listed by Android Studio (using "Tools > Android > AVD Manager") and the AVDs listed by sdk command line tool "android avd".
I suppose that Android Studio, with its internal AVD Manager, does not use the android.bat modified path ; it relies on the ANDROID_SDK_HOME variable to locate AVDs.
My own tests have shown that Android tools correctly use the ANDROID_SDK_HOME variable.
Therefore, there is no point, as far as I know, in modifying android.bat, and using the environment variable should be preferred.
there are major 4 steps
1. copy the .android folder to your desired location as i did in D:\Android\.android
2. set ANDROID_AVD_HOME in environment variables like ANDROID_AVD_HOME D:\Android\.android\avd
3. change avd name.ini file contents with new location like
avd.ini.encoding=UTF-8
path=D:\Android\.android\avd\Pixel_2_API_29.avd
path.rel=avd\Pixel_2_API_29.avd
target=android-29
4. restart android studio
1 - Move AVD to new Folder
2 - start Menu > Control Panel > System > Advanced System Settings (on the left) > Environment Variables
Add a new user variable:
Variable name: ANDROID_AVD_HOME
Variable value: a path to a directory of your choice
3 - Change the file .INI Set new folder.
4 - Open Android Studio
WORKS - Windows 2010
MORE INSTRUCTIONS : https://developer.android.com/studio/command-line/variables
In my case, what I concerned about is the C: drive disk space.
So what I did is copy the ".avd" folder(not file) to other drive, and leave the ".ini" file there but change it to point to the moved
I think the easiest way is to move the avd folder from C:\Users[USER].android folder to your desired location then create a symbolic link to it in C:\Users[USER].android with the same name.
If you wonder how to do this, first install Link Shell Extension. After folder movement right click on it and select Pick Link Source then right click in .android folder and in Drop As... sub menu select Symbolic Link.
I followed https://www.mysysadmintips.com/windows/clients/761-move-android-studio-avd-folder-to-a-new-location.
Start copying a folder "C:\Users\user\.android\avd" to "D:\Android\.android\avd" (or something else).
Close Android Studio and running emulators.
Press Win + Break and open Advanced System Settings. Then press Environment Variables. Add a user variable ANDROID_SDK_HOME. (I didn't experiment with ANDROID_AVD_HOME.) In Variable value field write D:\Android. If you also moved SDK to another folder, change ANDROID_HOME (I forgot to change it and some emulators didn't launch, see https://stackoverflow.com/a/57408085/2914140).
Wait until the folder will finish copying and start Android Studio.
Open Android Virtual Device Manager and see a list of emulators. If you don't see emulators and they existed, then probably you entered wrong path into user variable value in step 3. In this case close AS, change the variable and open AS again.
Start any emulator. It will try to restore it's state, but it sometimes fails. A black screen can appear instead of Android wallpaper.
In this case you can:
a. Restart your emulator. To do this close running emulator, then in AVD Manager click Cold Boot Now.
b. If this didn't help, open emulator settings, found in file "D:\Android\.android\avd\Pixel_API_27.ini".
Change a path to a new AVD folder. Restart the emulator.
Delete old AVD folder from "C:\Users\user\.android\avd".
For Windows 10 :
ANDROID_SDK_HOME
this link helped me.
Then just moved all content of "avd" to the new location. Now you may need to change the value of "path=" in the configuration Setting file of each avds to the new location. You can see the old avds in avd manager in Android Studio and they work.
ANDROID_SDK_HOME also worked for me on Windows 8 x64
also find all location (in my case it was d:\.android) and delete it. You won't need it anymore.
In AVD manager, after setting up AVD using a target with Google APIs, on run was getting error.
Detail showed: "AVD Unknown target 'Google Inc.:Google APIs:...... "
During install (on Win7 system) I had chosen a SDK directory location, instead of accepting C:\Users\...
I'd then added that directory to environment variable 'path'
Command line: android list targets did show a couple of Google apis.
Setting ANDROID_SDK_HOME to my install path fixed the avd run error.
Variable name: ANDROID_SDK_HOME
Variable value: C:\Users>User Name
worked for me.
MacOs
Get a directory adv
./emulator -help-datadir
the default directory is:
/Users/{your_computer_user_name}/.android
and then Go to avd Folder edit .ini file with path to your custom emulator directory
example :
path=/Volumes/Macintos/_emulatorandroid/avd/Nexus_5X_API_27.avd
path.rel=avd/Nexus_5X_API_27.avd
target=android-27
and then save. Now your Emulator haschange
And Result:

Using symbolic links inside OS X application bundles

I'm having a following problem. I have a bundle that has the following structure:
B.app/Contents/Frameworks -> link to an existing FS location [1]
B.app/Contents/Info.plist
B.app/Contents/MacOS
B.app/Contents/MacOS/AliasBinary -> link to an existing binary called ExistingBinary [2]
B.app/Contents/Resources -> link to an existing FS location [3]
Links [1] and [3] are just links to existing filesystem locations (i.e. directories) that are outside of the bundle. AliasBinary is a link to another application that I don't want to copy to the bundle, but would like to share it between many bundles. The latter binary is called ExistingBinary
The problem I'm having is that calling
$ open B.app
does open the application but only if the previous instance of ExistingBinary is not running. The same applies for double clicking on B.app. If there's no previous instance of ExistingBinary running then everything works correctly. Once ExistingBinary is started I can no longer start B.app by double clicking or by calling open B.app
Help!
EDIT:
The funny fact is that everything works if the bundle is inside /Applications but when I move it outside /Applications it just restores focus on the first instance of an app.
open -n helps, but that's not what I want :)
This may be the default launch services behaviour of not opening existing applications twice.
In Leopard, try
open -n B.app
or if you have the launch utility:
launch -m B.app

Resources