#!/bin/sh
+## make $USERNAME.lock file
+tizen_vms_path="${HOME}/tizen-sdk-data"
+echo $tizen_vms_path
+echo $tizen_vms_path > $TIZEN_SDK_INSTALL_PATH/tools/emulator/bin/.$USER.lock
+
## User Define for desktop menu
currentPath=`pwd`
desktoppath=~/.local/share/applications
-i "$iconpath/$em_iconfile" \
-n "$em_name" \
-c "$em_comment"
+
@ECHO OFF\r
+:: make shortcut menu ::::::::::::::::::::::::::::::::::::::::::::::\r
set em_shortcut_name=Emulator Manager\r
set execute_path=tools\emulator\bin\r
set em_execute_file=emulator-manager.exe\r
wscript.exe %MAKESHORTCUT_PATH% /shortcut:"%em_shortcut_name%" /target:"%program_path%\%em_execute_file%" /icon:"%desktop_menu_icon_path%\%em_icon_file%"\r
echo Setting registry\r
reg add "hklm\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /f /v %program_path%\%em_execute_file% /t REG_SZ /d RUNASADMIN\r
-echo COMPLETE\r
+\r
+:: make %username%.lock file :::::::::::::::::::::::::::::::::::::::::\r
+FOR /F "skip=2 tokens=2,3,*", %%A IN ('REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Local AppData"') DO (\r
+ set config_path=%%C\r
+)\r
+set tizen_vms_path=%config_path%\tizen-sdk-data\r
+echo %tizen_vms_path% > %program_path%\.%USERNAME%.lock\r
+echo COMPLETE
\ No newline at end of file
private ArrayList<Platform> platformList = null;
private static CommandLineParser processor = null;
- private static boolean isConsoleMode = false;
- private static int vmsPathIndex = -1;
+ private static boolean isConsoleMode = true;
// for multi touch
private static boolean isInhoseMode = true;
- // for windows
- private static String emulatorVMsPath = null;
public static EmulatorManager getInstance() {
return instance;
static void checkConsoleMode(String[] args) {
if (args.length > 0) {
- String s = null;
- for (int i = 0; i < args.length; i++) {
- s = args[i];
+ for (String s : args) {
// workspace
if (s.startsWith("--w") || s.startsWith("-w")) {
isConsoleMode = false;
- ++i;
break;
}
// inhouse
isConsoleMode = false;
break;
}
- // vms path for windows
- else if (s.startsWith("--vms")) {
- //isConsoleMode = false;
- vmsPathIndex = i;
- emulatorVMsPath = args[++i];
- }
- else {
- isConsoleMode = true;
- }
}
} else {
isConsoleMode = false;
}
} else if (args[i].equals("--inhouse")) {
isInhoseMode = true;
- } else if (args[i].equals("--vms")) {
- ++i;
} else {
isArgsError = true;
}
checkConsoleMode(args);
if (isConsoleMode) {
- String[] args2 = null;
- if (vmsPathIndex != -1) {
- args2 = new String[args.length-2];
- int j = 0;
- for (int i = 0; i < args.length; i++) {
- if (i == vmsPathIndex) {
- ++i;
- continue;
- }
- args2[j++] = args[i];
- }
- args = args2;
- }
EMLogger.getInstance().initConsoleLogger();
try {
}
SelectWorkspace.getWorkspace(isConsoleMode);
- /*
- if (!SelectWorkspace.getWorkspace(isConsoleMode)) {
- exitEmulatorManager(-1);
- }
- */
processor = new CommandLineParser();
processor.parseArgs(args);
- instance = new EmulatorManager(isInhoseMode ? ManagerModeType.INHOUSE_MODE
- : ManagerModeType.PUBLIC_MODE);
-
- // check hax or kvm
- CheckVirtualization.getInstance().check();
- CheckSDCard.CheckSwapDir();
- try {
- EmulatorVMs.getInstance().loadProperties();
- } catch (Exception e) {
- EMLogger.getLogger().log(Level.WARNING, e.getMessage());
- }
- instance.makePlatformList();
-
- instance.startConsoleProcessor();
-
} else {
EMLogger.getInstance().initLogger();
}
parseArgs(args);
- instance = new EmulatorManager(isInhoseMode ? ManagerModeType.INHOUSE_MODE
- : ManagerModeType.PUBLIC_MODE);
+ }
+ instance = new EmulatorManager(isInhoseMode ? ManagerModeType.INHOUSE_MODE
+ : ManagerModeType.PUBLIC_MODE);
- EMLogger.getLogger().log(Level.INFO, "Start Emulator Manager!!\n");
+ // check hax or kvm
+ CheckVirtualization.getInstance().check();
- // check hax or kvm
- CheckVirtualization.getInstance().check();
+ // check SD Card folder
+ CheckSDCard.CheckSDCardDir();
+ CheckSDCard.CheckSwapDir();
- // check SD Card folder
- CheckSDCard.CheckSDCardDir();
- CheckSDCard.CheckSwapDir();
+ try {
+ EmulatorVMs.getInstance().loadProperties();
+ } catch (Exception e) {
+ EMLogger.getLogger().log(Level.WARNING, e.getMessage());
+ }
- try {
- EmulatorVMs.getInstance().loadProperties();
- } catch (Exception e) {
- EMLogger.getLogger().log(Level.WARNING, e.getMessage());
- }
- instance.makePlatformList();
+ instance.makePlatformList();
+
+ if (isConsoleMode) {
+ instance.startConsoleProcessor();
+ } else {
+ EMLogger.getLogger().log(Level.INFO, "Start Emulator Manager!!\n");
instance.preare();
instance.DrawUI();
instance.dispose();
-
}
+
} catch (Exception e) {
e.printStackTrace();
}
}
- public static String getEmulatorVMsPath() {
- return emulatorVMsPath;
- }
-
public enum ManagerModeType {
PUBLIC_MODE("public"),
INHOUSE_MODE("inhouse");
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.URISyntaxException;
}
// tizen_sdk path
+ String tizenSDKDataPath = "";
{
File f = null;
- if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
- f = new File(EmulatorVMs.getInstance().getTizenSdkDataPath() + File.separator + "tizensdkpath");
+ File lockFile = new File(currentPath + File.separator
+ + "." + System.getProperty("user.name") + ".lock");
+ if (lockFile.exists()) {
+ BufferedReader in = null;
+ try {
+ in = new BufferedReader(new FileReader(lockFile));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ if (in != null) {
+ try {
+ tizenSDKDataPath = in.readLine();
+ } catch (IOException e) {
+ //e.printStackTrace();
+ } finally {
+ try {
+ in.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ if (tizenSDKDataPath != null && !tizenSDKDataPath.equals("")) {
+ f = new File(tizenSDKDataPath + File.separator + "tizensdkpath");
} else {
String home = System.getProperty("user.home");
f = new File(home + File.separator + "tizen-sdk-data" + File.separator + "tizensdkpath");
}
+
if (f.exists()) {
try {
BufferedReader in = new BufferedReader(new FileReader(f));
}
}
} catch (IOException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
{
String sdb_suffix;
if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1)
- sdb_suffix = toolsPath + File.separator + "sdb.exe";
+ sdb_suffix = File.separator + "sdb.exe";
else
- sdb_suffix = toolsPath + File.separator + "sdb";
+ sdb_suffix = File.separator + "sdb";
sdbPath = toolsPath + sdb_suffix;
}
vmsPath = EmulatorVMs.getInstance().getVMsConfigDirectory();
swapPath = workspacePath + File.separator + swap_suffix;
- //testPrintPath();
+ EmulatorVMs.makeSDKDataPath(tizenSDKDataPath);
+ setVMSPath();
+ testPrintPath();
}
public static void setVMSPath() {
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.stream.StreamSource;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.logging.EMLogger;
import org.tizen.emulator.manager.tool.FilePath;
import org.tizen.emulator.manager.tool.StringResource;
-import org.tizen.emulator.manager.ui.MessageDialog;
import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration;
import org.tizen.emulator.manager.vms.xml.ObjectFactory;
static String tizenSdkDataPath="";
static String vmsBaseDirectoryName = "";
static String vmsConfigDirectory = "";
- static {
- if (EmulatorManager.getEmulatorVMsPath() != null
- && !EmulatorManager.getEmulatorVMsPath().isEmpty()) {
- tizenSdkDataPath = EmulatorManager.getEmulatorVMsPath()
- + File.separator + "tizen-sdk-data";
- } else {
- if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
- String error = "Start EmulatorManager without emulator-manager.exe\n" +
- "EmulatorManager's workspace be changed. Please check workspace path.\n";
- if (!EmulatorManager.isConsoleMode()) {
- new MessageDialog(new Shell(Display.getCurrent()))
- .openInfoDialog(error + "Click about menu!");
- }
- EMLogger.getLogger().warning(error);
- }
+
+ public static void makeSDKDataPath(String sdkDataPath) {
+ if (sdkDataPath == null || sdkDataPath.equals("")) {
tizenSdkDataPath = System.getProperty("user.home")
+ File.separator + "tizen-sdk-data";
+ } else {
+ tizenSdkDataPath = sdkDataPath;
}
vmsBaseDirectoryName = tizenSdkDataPath
+ File.separator + "emulator-vms";
vmsConfigDirectory = vmsBaseDirectoryName + File.separator + "vms";
+
+ File vmsFolder = new File (vmsConfigDirectory);
+ if (!vmsFolder.exists()) {
+ vmsFolder.mkdirs();
+ }
}
List<VMsProperty> propertiesList = new ArrayList<VMsProperty>();
strcat(strCommand, "\"");\r
}\r
\r
+ /*\r
strcat(strCommand, " --vms \"");\r
strcat(strCommand, strLocalAppDataPath);\r
strcat(strCommand, "\"");\r
+ */\r
\r
if(argc > 0) {\r
for(i = 1; i < argc; i++) {\r