natsukagami / kjudge

A simple system for hosting competitive programming contests.
GNU Affero General Public License v3.0
23 stars 11 forks source link

Fix file access for embedded files on windows #103

Closed minhnhatnoe closed 1 year ago

minhnhatnoe commented 1 year ago

Windows uses '\' as path separator, while Linux uses '/'. However, Go's embed file system uses '/' on all platforms.

To reproduce this, delete all leftover database files then run the Kjudge executable to trigger db migration files access.

natsukagami commented 1 year ago

Perhaps we should add to the embed package documentation somewhere that fs.FS (or embed.Content) always expose a /-delimited file system, and is converting / to \ on Windows even on development build.

minhnhatnoe commented 1 year ago

Perhaps we should add to the embed package documentation somewhere that fs.FS (or embed.Content) always expose a /-delimited file system, and is converting / to \ on Windows even on development build.

Okay. Added doc.go file for package embed.