| |
| |
| |
| |
| |
|
|
| import path from 'node:path'; |
| import { fileURLToPath } from 'node:url'; |
|
|
| |
| function testPathNormalization() { |
| |
| const testPath = path.join('test', 'project', 'src', 'file.md'); |
| const absoluteTestPath = path.resolve('test', 'project', 'src', 'file.md'); |
|
|
| console.log('Testing path normalization:'); |
| console.log('Relative path:', testPath); |
| console.log('Absolute path:', absoluteTestPath); |
|
|
| |
| const joinedPath = path.join('test', 'project', 'src', 'file.md'); |
| console.log('Joined path:', joinedPath); |
|
|
| |
| console.log('Normalized relative path:', path.normalize(testPath)); |
| console.log('Normalized absolute path:', path.normalize(absoluteTestPath)); |
|
|
| |
| const testContent = `--- File: ${absoluteTestPath} ---\nContent\n--- End of File: ${absoluteTestPath} ---`; |
| console.log('\nTest content with platform-agnostic paths:'); |
| console.log(testContent); |
|
|
| |
| const marker = `--- File: ${absoluteTestPath} ---`; |
| console.log('\nTrying to match:', marker); |
| console.log('Direct match:', testContent.includes(marker)); |
|
|
| |
| const normalizedMarker = `--- File: ${path.normalize(absoluteTestPath)} ---`; |
| console.log( |
| 'Normalized marker match:', |
| testContent.includes(normalizedMarker), |
| ); |
|
|
| |
| const __filename = fileURLToPath(import.meta.url); |
| console.log('\nCurrent file path:', __filename); |
| console.log('Directory name:', path.dirname(__filename)); |
| } |
|
|
| testPathNormalization(); |
|
|