help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
ruby-calculator
/
node_modules
/
@parcel
/
watcher
/
src
/
windows
RSK World
ruby-calculator
Ruby Calculator Pro - Interactive Calculator with 8 Types + Mathematical Functions + Rails MVC + Modern Web Interface + API Integration + Educational Design
windows
  • WindowsBackend.cc7.9 KB
  • WindowsBackend.hh360 B
  • win_utils.cc1.2 KB
  • win_utils.hh238 B
win_utils.cc
node_modules/@parcel/watcher/src/windows/win_utils.cc
Raw Download
Find: Go to:
#include "./win_utils.hh"

std::wstring utf8ToUtf16(std::string input) {
  unsigned int len = MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1, NULL, 0);
  WCHAR *output = new WCHAR[len];
  MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1, output, len);
  std::wstring res(output);
  delete[] output;
  return res;
}

std::string utf16ToUtf8(const WCHAR *input, DWORD length) {
  unsigned int len = WideCharToMultiByte(CP_UTF8, 0, input, length, NULL, 0, NULL, NULL);
  char *output = new char[len + 1];
  WideCharToMultiByte(CP_UTF8, 0, input, length, output, len, NULL, NULL);
  output[len] = '\0';
  std::string res(output);
  delete[] output;
  return res;
}

std::string normalizePath(std::string path) {
  // Prevent truncation to MAX_PATH characters by adding the \\?\ prefix
  std::wstring p = utf8ToUtf16("\\\\?\\" + path);

  // Get the required length for the output
  DWORD len = GetLongPathNameW(p.data(), NULL, 0);
  if (!len) {
    return path;
  }

  // Allocate output array and get long path
  WCHAR *output = new WCHAR[len];
  len = GetLongPathNameW(p.data(), output, len);
  if (!len) {
    delete[] output;
    return path;
  }

  // Convert back to utf8
  std::string res = utf16ToUtf8(output + 4, len - 4);
  delete[] output;
  return res;
}
45 lines•1.2 KB
cpp

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer