You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/11/18 19:46:01 UTC

[GitHub] MarkMoss commented on issue #242: MingW/Windows path issue causes newt load to fail

MarkMoss commented on issue #242: MingW/Windows path issue causes newt load to fail
URL: https://github.com/apache/mynewt-newt/issues/242#issuecomment-439719986
 
 
   As a follow-up, it looks like TryRelPath() in util.go changes the path separators from '/' to '\\' under MinGW.
   
   Modifying Load() in load.go so that it doesn't call TryRelPath() works around the issue for me. 
   
   ```
   func (b *Builder) Load(imageSlot int, extraJtagCmd string) error {
   	if b.appPkg == nil {
   		return util.NewNewtError("app package not specified")
   	}
   
   	/* Populate the package list and feature sets. */
   	err := b.targetBuilder.PrepBuild()
   	if err != nil {
   		return err
   	}
   
   	envSettings := map[string]string{
   		"IMAGE_SLOT": strconv.Itoa(imageSlot),
   		"FEATURES":   b.FeatureString(),
   	}
   	if extraJtagCmd != "" {
   		envSettings["EXTRA_JTAG_CMD"] = extraJtagCmd
   	}
   	settings := b.cfg.SettingValues()
   
   	var flashTargetArea string
   	if parse.ValueIsTrue(settings["BOOT_LOADER"]) {
   		envSettings["BOOT_LOADER"] = "1"
   
   		flashTargetArea = "FLASH_AREA_BOOTLOADER"
   		util.StatusMessage(util.VERBOSITY_DEFAULT,
   			"Loading bootloader\n")
   	} else {
   		if imageSlot == 0 {
   			flashTargetArea = "FLASH_AREA_IMAGE_0"
   		} else if imageSlot == 1 {
   			flashTargetArea = "FLASH_AREA_IMAGE_1"
   		}
   		util.StatusMessage(util.VERBOSITY_DEFAULT,
   			"Loading %s image into slot %d\n", b.buildName, imageSlot+1)
   	}
   
   	bspPkg := b.targetBuilder.bspPkg
   	tgtArea := bspPkg.FlashMap.Areas[flashTargetArea]
   	if tgtArea.Name == "" {
   		return util.NewNewtError(fmt.Sprintf("No flash target area %s\n",
   			flashTargetArea))
   	}
   	envSettings["FLASH_OFFSET"] = "0x" + strconv.FormatInt(int64(tgtArea.Offset), 16)
   
   	// Convert the binary path from absolute to relative.  This is required for
   	// compatibility with unix-in-windows environemnts (e.g., cygwin).
   	//binPath := util.TryRelPath(b.AppBinBasePath())
   	binPath := b.AppBinBasePath()
   	if err := Load(binPath, b.targetBuilder.bspPkg, envSettings); err != nil {
   		return err
   	}
   
   	return nil
   }
   ```
   
    I assume there is some environment where TryRelPath() is still needed, so removing it is probably also not a workable solution.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services