in vhdcore/header/parentlocator/parentLocator.go [47:75]
func (l *ParentLocator) SetPlatformSpecificFileLocator(fileLocator []byte) {
// 1. For the platform codes - W2Ru and W2Ku, fileLocator contents is UTF-16 encoded.
// 2. For the platform code - MacX, fileLocator contents is UTF-8 encoded.
// 3. For unknown platform code fileLocator contents is treated as UTF-16 encoded.
//
// For 1 the byte order is little-endian
// For 3 the byte order is big-endian
if l.PlatformCode == PlatformCodeWi2R || l.PlatformCode == PlatformCodeWi2K {
log.Panicf("Deprecated PlatformCode: %d", l.PlatformCode)
}
if l.PlatformCode == PlatformCodeMac {
log.Panicf("Handling Mac OS alias stored as a blob is not implemented, PlatformCode: %d", l.PlatformCode)
}
if l.PlatformCode == PlatformCodeNone {
l.PlatformSpecificFileLocator = ""
} else if l.PlatformCode == PlatformCodeW2Ru {
//TODO: Add differencing disks path name, this is relative path
l.PlatformSpecificFileLocator = common.Utf16BytesToStringLE(fileLocator)
} else if l.PlatformCode == PlatformCodeW2Ku {
l.PlatformSpecificFileLocator = common.Utf16BytesToStringLE(fileLocator)
} else if l.PlatformCode == PlatformCodeMacX {
l.PlatformSpecificFileLocator = string(fileLocator)
} else {
l.PlatformSpecificFileLocator = strings.TrimSuffix(common.Utf16BytesToStringBE(fileLocator), "\x00")
}
}