builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ProjectExportsGatherer.java
changeset 639 d20fd8892aa1
parent 638 5bdd98f18bd3
equal deleted inserted replaced
638:5bdd98f18bd3 639:d20fd8892aa1
   250 		for (IExport export : exports) {
   250 		for (IExport export : exports) {
   251 			IPath targetPath = export.getTargetPath();
   251 			IPath targetPath = export.getTargetPath();
   252 			
   252 			
   253 			// we only support exports which might reasonably make it onto the device,
   253 			// we only support exports which might reasonably make it onto the device,
   254 			// which means ones either explictly or implicitly targeting a drive.
   254 			// which means ones either explictly or implicitly targeting a drive.
   255 			if (isAbsoluteDrivePath(targetPath)) {
   255 			if (isWin32DrivePath(targetPath)) {
   256 				// accept
   256 				// accept
   257 			}
   257 			}
   258 			else if (targetPath.isAbsolute() && targetPath.getDevice() == null
   258 			else if (targetPath.isAbsolute() && targetPath.getDevice() == null
   259 					&& targetPath.segmentCount() > 1
   259 					&& targetPath.segmentCount() > 1
   260 					&& targetPath.segment(0).equalsIgnoreCase("epoc32")) { //$NON-NLS-1$
   260 					&& targetPath.segment(0).equalsIgnoreCase("epoc32")) { //$NON-NLS-1$
   332 		return (path.getDevice() != null && path.getDevice().length() == 2) 
   332 		return (path.getDevice() != null && path.getDevice().length() == 2) 
   333 			|| (!HostOS.IS_WIN32 && path.segmentCount() > 0 && path.segment(0).matches("[A-Za-z]:"));
   333 			|| (!HostOS.IS_WIN32 && path.segmentCount() > 0 && path.segment(0).matches("[A-Za-z]:"));
   334 	}
   334 	}
   335 
   335 
   336 	/**
   336 	/**
   337 	 * Tell if the path is absolute -- e.g., according to the host or to Windows conventions.
       
   338 	 * @param path
       
   339 	 */
       
   340 	protected boolean isAbsoluteDrivePath(IPath path) {
       
   341 		if ((HostOS.IS_WIN32 && path.isAbsolute()) || isWin32DrivePath(path))
       
   342 			return true;
       
   343 		return false;
       
   344 	}
       
   345 	
       
   346 	/**
       
   347 	 * Convert a path like c:\private\foo.svg to $(EPOCROOT)data\c\private\foo.svg 
   337 	 * Convert a path like c:\private\foo.svg to $(EPOCROOT)data\c\private\foo.svg 
   348 	 * @param host
   338 	 * @param host
   349 	 * @return converted path or original
   339 	 * @return converted path or original
   350 	 */
   340 	 */
   351 	private IPath epocHostToEPOCROOTData(IPath host) {
   341 	private IPath epocHostToEPOCROOTData(IPath host) {
   352 		if (!isAbsoluteDrivePath(host))
   342 		if (!isWin32DrivePath(host))
   353 			return host;
   343 			return host;
   354 		IPath nativ = epocRoot.append("epoc32").append("data") //$NON-NLS-1$ //$NON-NLS-2$
   344 		IPath nativ = epocRoot.append("epoc32").append("data") //$NON-NLS-1$ //$NON-NLS-2$
   355 			.append(convertDriveToPathSegment(host));
   345 			.append(convertDriveToPathSegment(host));
   356 		return nativ;
   346 		return nativ;
   357 	}
   347 	}
   359 	/**
   349 	/**
   360 	 * @param host
   350 	 * @param host
   361 	 * @return
   351 	 * @return
   362 	 */
   352 	 */
   363 	private IPath convertDriveToPathSegment(IPath host) {
   353 	private IPath convertDriveToPathSegment(IPath host) {
   364 		if (HostOS.IS_WIN32)
   354 		if (host.getDevice() != null)
   365 			return new Path(host.getDevice().substring(0, 1)).append(host.setDevice(null));
   355 			return new Path(host.getDevice().substring(0, 1)).append(host.setDevice(null));
   366 		else
   356 		else
   367 			return new Path(host.segment(0).substring(0, 1)).append(host.removeFirstSegments(1)); 
   357 			return new Path(host.segment(0).substring(0, 1)).append(host.removeFirstSegments(1)); 
   368 	}
   358 	}
   369 
   359 
   371 	 * Convert a path like c:\private\foo.svg to $(EPOCROOT)release\<platform>\<target>\<drive>\<path>
   361 	 * Convert a path like c:\private\foo.svg to $(EPOCROOT)release\<platform>\<target>\<drive>\<path>
   372 	 * @param host
   362 	 * @param host
   373 	 * @return converted path or original
   363 	 * @return converted path or original
   374 	 */
   364 	 */
   375 	private IPath epocHostToEPOCPlatformData(IPath host) {
   365 	private IPath epocHostToEPOCPlatformData(IPath host) {
   376 		if (!isAbsoluteDrivePath(host))
   366 		if (!isWin32DrivePath(host))
   377 			return host;
   367 			return host;
   378 		IPath nativ = epocRoot.append("epoc32").append("release").append(platform).append(target) //$NON-NLS-1$ //$NON-NLS-2$
   368 		IPath nativ = epocRoot.append("epoc32").append("release").append(platform).append(target) //$NON-NLS-1$ //$NON-NLS-2$
   379 			.append(convertDriveToPathSegment(host));
   369 			.append(convertDriveToPathSegment(host));
   380 		return nativ;
   370 		return nativ;
   381 	}
   371 	}