1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 package com.nokia.carbide.cdt.internal.builder; |
|
18 |
|
19 import java.io.File; |
|
20 |
|
21 import org.eclipse.cdt.core.settings.model.ICStorageElement; |
|
22 |
|
23 import com.nokia.carbide.cdt.builder.project.IROMBuilderInfo; |
|
24 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; |
|
25 import com.nokia.cpp.internal.api.utils.core.HostOS; |
|
26 |
|
27 |
|
28 public class ROMBuilderInfo implements IROMBuilderInfo { |
|
29 |
|
30 private static final String ROMBUILDCOMMANDLINESTORAGE = "ROMBUILDCOMMANDLINESTORAGE"; //$NON-NLS-1$ |
|
31 private static final String ROMBUILDWORKINGDIRECTORYSTORAGE = "ROMBUILDWORKINGDIRECTORYSTORAGE"; //$NON-NLS-1$ |
|
32 |
|
33 |
|
34 private String romBuildCommandLine; |
|
35 private String romBuildWorkingDirectory; |
|
36 |
|
37 |
|
38 public ROMBuilderInfo(ISymbianSDK sdk) { |
|
39 |
|
40 this.romBuildCommandLine = ""; //$NON-NLS-1$ |
|
41 this.romBuildWorkingDirectory = HostOS.IS_WIN32 ? "C:\\" : "/tmp"; //$NON-NLS-1$ //$NON-NLS-2$ |
|
42 |
|
43 // now set epoc32\rom folder in the sdk as the default working dir |
|
44 // this is most common folder that rom images are built from for most symbian kits.. |
|
45 String dir = sdk.getEPOCROOT() + "epoc32/rom/"; //$NON-NLS-1$ |
|
46 if (new File(dir).exists()) |
|
47 romBuildWorkingDirectory = dir; |
|
48 } |
|
49 |
|
50 public void loadFromStorage(ICStorageElement rootStorage) { |
|
51 String value = rootStorage.getAttribute(ROMBUILDCOMMANDLINESTORAGE); |
|
52 if (value != null) { |
|
53 romBuildCommandLine = value; |
|
54 } |
|
55 |
|
56 value = rootStorage.getAttribute(ROMBUILDWORKINGDIRECTORYSTORAGE); |
|
57 if (value != null) { |
|
58 romBuildWorkingDirectory = value; |
|
59 } |
|
60 } |
|
61 |
|
62 public void saveToStorage(ICStorageElement rootStorage) { |
|
63 if (romBuildCommandLine.trim().length() > 0) { |
|
64 rootStorage.setAttribute(ROMBUILDCOMMANDLINESTORAGE, romBuildCommandLine); |
|
65 } |
|
66 |
|
67 if (romBuildWorkingDirectory.trim().length() > 0) { |
|
68 rootStorage.setAttribute(ROMBUILDWORKINGDIRECTORYSTORAGE, romBuildWorkingDirectory); |
|
69 } |
|
70 } |
|
71 |
|
72 public String getCommandLine() { |
|
73 return romBuildCommandLine; |
|
74 } |
|
75 |
|
76 public String getWorkingDirectory() { |
|
77 return romBuildWorkingDirectory; |
|
78 } |
|
79 |
|
80 public void setCommandLine(String romBuildCommandLine) { |
|
81 this.romBuildCommandLine = romBuildCommandLine; |
|
82 } |
|
83 |
|
84 public void setWorkingDirectory(String romBuildWorkingDirectory) { |
|
85 this.romBuildWorkingDirectory = romBuildWorkingDirectory; |
|
86 } |
|
87 } |
|